|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sharing violation error on deletionI asked about this before, but am against deadline and haven't received any solutions yet, so thought would try again. I have an app that uses a VB6 front end to an Excel/Word VBA app.When the vb part starts up it searches for Excel, Word and VB temp files and deletes them. This has worked fine before including on my Win XP SP1 Pro/Office 2003 machine. But when I run it under a Virtual PC testbed of Win 2K/Office 2K it's giving me errors. When I run it under the exe or debug I get a "Run-time error 70. Permission denied" as it tries to programmatically delete the Word temp files. When I try to manually delete the Word temp file it gives an "Error deleting File or Folder: Cannot delete (temp file name). There has been a sharing violation. The source or destination file may be in use." Read only is not set. Task manager shows no open programs or processes for Word or Excel that I can see. Since it's running under Virtual PC 2004 I am trying to update that to SP1 in case that is issue but am getting versioning error(error code 1638 Error_product-version:Another version of this product is already installed..etc) on Windows Installer (I have Win XP SP1 so doesn't have the latest version). But having issues to resolve with that, but not sure the VPC SP1 is issue or not. Any idea what wrong or how to fix? Is Win 2K pickier on permissions? Thanks God bless Van "VanS" <V***@discussions.microsoft.com> wrote in message I can't imaging what's wrong there. Win2k's not pickier. If anything, XP news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > > Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > Thanks God bless > Van would be the pickier of the two. Since Windows Explorer can't delete them, there's got to be something wrong somewhere. VB surely won't be able to delete the files if Explorer can't. Since you're also getting problems from VPC itself (and it's installer), the only thing I can suggest is remove it from your system, run RegClean, re-install VPC and its service pack and re-test. Or, find someone with Win2k/Office2k and have them test it for you. -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. >Win2k's not pickier In the contrary, W2K has a big bug tying up files.Show quoteHide quote "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message news:%23PNGVG6kFHA.3312@tk2msftngp13.phx.gbl... > "VanS" <V***@discussions.microsoft.com> wrote in message > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... >> >> Any idea what wrong or how to fix? Is Win 2K pickier on permissions? >> Thanks God bless >> Van > > I can't imaging what's wrong there. Win2k's not pickier. If anything, XP > would be the pickier of the two. > > Since Windows Explorer can't delete them, there's got to be something > wrong somewhere. VB surely won't be able to delete the files if Explorer > can't. Since you're also getting problems from VPC itself (and it's > installer), the only thing I can suggest is remove it from your system, > run RegClean, re-install VPC and its service pack and re-test. Or, find > someone with Win2k/Office2k and have them test it for you. > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > Ted,
Thanks for your reply. You say " In the contrary, W2K has a big bug tying up files". Can you tell me any more about that and/or direct me to resources, KB articles or some such on? Thanks again, appreciate it. Van Show quoteHide quote "Ted" wrote: > >Win2k's not pickier > In the contrary, W2K has a big bug tying up files. > > > "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message > news:%23PNGVG6kFHA.3312@tk2msftngp13.phx.gbl... > > "VanS" <V***@discussions.microsoft.com> wrote in message > > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > >> > >> Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > >> Thanks God bless > >> Van > > > > I can't imaging what's wrong there. Win2k's not pickier. If anything, XP > > would be the pickier of the two. > > > > Since Windows Explorer can't delete them, there's got to be something > > wrong somewhere. VB surely won't be able to delete the files if Explorer > > can't. Since you're also getting problems from VPC itself (and it's > > installer), the only thing I can suggest is remove it from your system, > > run RegClean, re-install VPC and its service pack and re-test. Or, find > > someone with Win2k/Office2k and have them test it for you. > > > > -- > > Ken Halter - MS-MVP-VB - http://www.vbsight.com > > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > > Please keep all discussions in the groups.. > > > > > I tried research the problem for long time, had no luck.
I tried to copy simple system files, that are never locked, they just get locked when they are used. W2K doesn't release them. Try different ways to delete the files. Use ShlFileOperation, Here are some of the functions I tried in W2K '''''''''''''''''''''''''''''''''''''''''' Dim iFileLocked as Long, iFileInUse as Long Private Sub Command1_click() iFileLocked "C\Windows\Explorer.exe" iFileInUse "C\Windows\Explorer.exe" if iFileInUse =1 then msgbox "In Use" if iFileLocked =1 then msgbox "Locked" End Sub Function IsFileOpen(filename As String) Dim filenum As Integer, errnum As Integer On Error Resume Next ' Turn error checking off. filenum = FreeFile() ' Get a free file number. ' Attempt to open the file and lock it. Open filename For Input Shared As #filenum Close filenum ' Close the file. errnum = Err ' Save the error number that occurred. On Error GoTo 0 ' Turn error checking back on. ' Check to see which error occurred. Select Case errnum ' No error occurred. ' File is NOT already open by another user. Case 0 IsFileOpen = False MsgBox "file is not open" ' Error number for "Permission Denied." ' File is already opened by another user. Case 70 IsFileOpen = True MsgBox "file is Open" ' Another error occurred. ' ListLocked.AddItem filename iFileLocked = 1 Case Else Error errnum End Select End Function Function IsExclusive(aFile$) As Boolean iFileLocked = 0 iFileInUse = 0 Dim Buf As Integer On Local Error GoTo CEError IsExclusive = True If Dir(aFile$) = "" Then Exit Function 'a simple routine to detect locked files, but doesn't detect 'files used by windows. ' SetAttr aFile$, vbNormal 'File has to be not hidden. 'Buf = FreeFile: Open aFile$ For Binary Lock Read Write As Buf Buf = FreeFile: Open aFile$ For Binary Access Read Write Lock Read Write As Buf Close Buf Exit Function CEError: msgbox aFile$ iFileInUse = 1 Exit Function End Function Show quoteHide quote "VanS" <V***@discussions.microsoft.com> wrote in message news:135B2D39-462F-4145-A5C6-077C8B1CD721@microsoft.com... > Ted, > Thanks for your reply. > You say " In the contrary, W2K has a big bug tying up files". Can you tell > me any more about that and/or direct me to resources, KB articles or some > such on? > Thanks again, appreciate it. > Van > "Ted" wrote: > >> >Win2k's not pickier >> In the contrary, W2K has a big bug tying up files. >> >> >> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message >> news:%23PNGVG6kFHA.3312@tk2msftngp13.phx.gbl... >> > "VanS" <V***@discussions.microsoft.com> wrote in message >> > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... >> >> >> >> Any idea what wrong or how to fix? Is Win 2K pickier on permissions? >> >> Thanks God bless >> >> Van >> > >> > I can't imaging what's wrong there. Win2k's not pickier. If anything, >> > XP >> > would be the pickier of the two. >> > >> > Since Windows Explorer can't delete them, there's got to be something >> > wrong somewhere. VB surely won't be able to delete the files if >> > Explorer >> > can't. Since you're also getting problems from VPC itself (and it's >> > installer), the only thing I can suggest is remove it from your system, >> > run RegClean, re-install VPC and its service pack and re-test. Or, find >> > someone with Win2k/Office2k and have them test it for you. >> > >> > -- >> > Ken Halter - MS-MVP-VB - http://www.vbsight.com >> > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm >> > Please keep all discussions in the groups.. >> > >> >> >> Thanks again for your input, Ted, Appreciate it.
So you never found a specific Microsoft-identified error in Win 2k? Is it more just and educated guess that Win 2k is the source? Thanks Van Show quoteHide quote "Ted" wrote: > I tried research the problem for long time, had no luck. > I tried to copy simple system files, that are never locked, > they just get locked when they are used. W2K doesn't release them. > > Try different ways to delete the files. > Use ShlFileOperation, > Here are some of the functions I tried in W2K > '''''''''''''''''''''''''''''''''''''''''' > Dim iFileLocked as Long, iFileInUse as Long > Private Sub Command1_click() > iFileLocked "C\Windows\Explorer.exe" > iFileInUse "C\Windows\Explorer.exe" > if iFileInUse =1 then msgbox "In Use" > if iFileLocked =1 then msgbox "Locked" > End Sub > Function IsFileOpen(filename As String) > Dim filenum As Integer, errnum As Integer > > On Error Resume Next ' Turn error checking off. > filenum = FreeFile() ' Get a free file number. > ' Attempt to open the file and lock it. > Open filename For Input Shared As #filenum > Close filenum ' Close the file. > errnum = Err ' Save the error number that occurred. > On Error GoTo 0 ' Turn error checking back on. > > ' Check to see which error occurred. > Select Case errnum > > ' No error occurred. > ' File is NOT already open by another user. > Case 0 > IsFileOpen = False > MsgBox "file is not open" > > ' Error number for "Permission Denied." > ' File is already opened by another user. > Case 70 > IsFileOpen = True > MsgBox "file is Open" > ' Another error occurred. > ' ListLocked.AddItem filename > iFileLocked = 1 > Case Else > Error errnum > End Select > > End Function > > Function IsExclusive(aFile$) As Boolean > iFileLocked = 0 > iFileInUse = 0 > Dim Buf As Integer > On Local Error GoTo CEError > IsExclusive = True > If Dir(aFile$) = "" Then Exit Function > 'a simple routine to detect locked files, but doesn't detect > 'files used by windows. > ' SetAttr aFile$, vbNormal 'File has to be not hidden. > 'Buf = FreeFile: Open aFile$ For Binary Lock Read Write As Buf > Buf = FreeFile: Open aFile$ For Binary Access Read Write Lock Read Write > As Buf > Close Buf > > Exit Function > CEError: > msgbox aFile$ > iFileInUse = 1 > Exit Function > End Function > > > "VanS" <V***@discussions.microsoft.com> wrote in message > news:135B2D39-462F-4145-A5C6-077C8B1CD721@microsoft.com... > > Ted, > > Thanks for your reply. > > You say " In the contrary, W2K has a big bug tying up files". Can you tell > > me any more about that and/or direct me to resources, KB articles or some > > such on? > > Thanks again, appreciate it. > > Van > > "Ted" wrote: > > > >> >Win2k's not pickier > >> In the contrary, W2K has a big bug tying up files. > >> > >> > >> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message > >> news:%23PNGVG6kFHA.3312@tk2msftngp13.phx.gbl... > >> > "VanS" <V***@discussions.microsoft.com> wrote in message > >> > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > >> >> > >> >> Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > >> >> Thanks God bless > >> >> Van > >> > > >> > I can't imaging what's wrong there. Win2k's not pickier. If anything, > >> > XP > >> > would be the pickier of the two. > >> > > >> > Since Windows Explorer can't delete them, there's got to be something > >> > wrong somewhere. VB surely won't be able to delete the files if > >> > Explorer > >> > can't. Since you're also getting problems from VPC itself (and it's > >> > installer), the only thing I can suggest is remove it from your system, > >> > run RegClean, re-install VPC and its service pack and re-test. Or, find > >> > someone with Win2k/Office2k and have them test it for you. > >> > > >> > -- > >> > Ken Halter - MS-MVP-VB - http://www.vbsight.com > >> > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > >> > Please keep all discussions in the groups.. > >> > > >> > >> > >> > > > > So you never found a specific Microsoft-identified error There was an error, but got you no place.Is the computer on a Network ? Show quoteHide quote "VanS" <V***@discussions.microsoft.com> wrote in message news:CC633FFA-1F05-4D33-B5B0-AE93A073A8ED@microsoft.com... > Thanks again for your input, Ted, Appreciate it. > So you never found a specific Microsoft-identified error in Win 2k? Is it > more just and educated guess that Win 2k is the source? > Thanks > Van > > "Ted" wrote: > >> I tried research the problem for long time, had no luck. >> I tried to copy simple system files, that are never locked, >> they just get locked when they are used. W2K doesn't release them. >> >> Try different ways to delete the files. >> Use ShlFileOperation, >> Here are some of the functions I tried in W2K >> '''''''''''''''''''''''''''''''''''''''''' >> Dim iFileLocked as Long, iFileInUse as Long >> Private Sub Command1_click() >> iFileLocked "C\Windows\Explorer.exe" >> iFileInUse "C\Windows\Explorer.exe" >> if iFileInUse =1 then msgbox "In Use" >> if iFileLocked =1 then msgbox "Locked" >> End Sub >> Function IsFileOpen(filename As String) >> Dim filenum As Integer, errnum As Integer >> >> On Error Resume Next ' Turn error checking off. >> filenum = FreeFile() ' Get a free file number. >> ' Attempt to open the file and lock it. >> Open filename For Input Shared As #filenum >> Close filenum ' Close the file. >> errnum = Err ' Save the error number that occurred. >> On Error GoTo 0 ' Turn error checking back on. >> >> ' Check to see which error occurred. >> Select Case errnum >> >> ' No error occurred. >> ' File is NOT already open by another user. >> Case 0 >> IsFileOpen = False >> MsgBox "file is not open" >> >> ' Error number for "Permission Denied." >> ' File is already opened by another user. >> Case 70 >> IsFileOpen = True >> MsgBox "file is Open" >> ' Another error occurred. >> ' ListLocked.AddItem filename >> iFileLocked = 1 >> Case Else >> Error errnum >> End Select >> >> End Function >> >> Function IsExclusive(aFile$) As Boolean >> iFileLocked = 0 >> iFileInUse = 0 >> Dim Buf As Integer >> On Local Error GoTo CEError >> IsExclusive = True >> If Dir(aFile$) = "" Then Exit Function >> 'a simple routine to detect locked files, but doesn't detect >> 'files used by windows. >> ' SetAttr aFile$, vbNormal 'File has to be not hidden. >> 'Buf = FreeFile: Open aFile$ For Binary Lock Read Write As Buf >> Buf = FreeFile: Open aFile$ For Binary Access Read Write Lock Read >> Write >> As Buf >> Close Buf >> >> Exit Function >> CEError: >> msgbox aFile$ >> iFileInUse = 1 >> Exit Function >> End Function >> >> >> "VanS" <V***@discussions.microsoft.com> wrote in message >> news:135B2D39-462F-4145-A5C6-077C8B1CD721@microsoft.com... >> > Ted, >> > Thanks for your reply. >> > You say " In the contrary, W2K has a big bug tying up files". Can you >> > tell >> > me any more about that and/or direct me to resources, KB articles or >> > some >> > such on? >> > Thanks again, appreciate it. >> > Van >> > "Ted" wrote: >> > >> >> >Win2k's not pickier >> >> In the contrary, W2K has a big bug tying up files. >> >> >> >> >> >> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message >> >> news:%23PNGVG6kFHA.3312@tk2msftngp13.phx.gbl... >> >> > "VanS" <V***@discussions.microsoft.com> wrote in message >> >> > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... >> >> >> >> >> >> Any idea what wrong or how to fix? Is Win 2K pickier on >> >> >> permissions? >> >> >> Thanks God bless >> >> >> Van >> >> > >> >> > I can't imaging what's wrong there. Win2k's not pickier. If >> >> > anything, >> >> > XP >> >> > would be the pickier of the two. >> >> > >> >> > Since Windows Explorer can't delete them, there's got to be >> >> > something >> >> > wrong somewhere. VB surely won't be able to delete the files if >> >> > Explorer >> >> > can't. Since you're also getting problems from VPC itself (and it's >> >> > installer), the only thing I can suggest is remove it from your >> >> > system, >> >> > run RegClean, re-install VPC and its service pack and re-test. Or, >> >> > find >> >> > someone with Win2k/Office2k and have them test it for you. >> >> > >> >> > -- >> >> > Ken Halter - MS-MVP-VB - http://www.vbsight.com >> >> > DLL Hell problems? Try ComGuard - >> >> > http://www.vbsight.com/ComGuard.htm >> >> > Please keep all discussions in the groups.. >> >> > >> >> >> >> >> >> >> >> >> Thanks again for your suggestions, Ken. I will keep those in mind.
Regard and blessings Van Show quoteHide quote "Ken Halter" wrote: > "VanS" <V***@discussions.microsoft.com> wrote in message > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > > > > Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > > Thanks God bless > > Van > > I can't imaging what's wrong there. Win2k's not pickier. If anything, XP > would be the pickier of the two. > > Since Windows Explorer can't delete them, there's got to be something wrong > somewhere. VB surely won't be able to delete the files if Explorer can't. > Since you're also getting problems from VPC itself (and it's installer), the > only thing I can suggest is remove it from your system, run RegClean, > re-install VPC and its service pack and re-test. Or, find someone with > Win2k/Office2k and have them test it for you. > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > Van,
Not that it will solve your problem, but it might point your to the reason: http://www.dr-hoiby.com/WhoLockMe/index.php NickHK Show quoteHide quote "VanS" <V***@discussions.microsoft.com> wrote in message news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > Hello, > I asked about this before, but am against deadline and haven't received any > solutions yet, so thought would try again. > I have an app that uses a VB6 front end to an Excel/Word VBA app.When the vb > part starts up it searches for Excel, Word and VB temp files and deletes > them. This has worked fine before including on my Win XP SP1 Pro/Office 2003 > machine. But when I run it under a Virtual PC testbed of Win 2K/Office 2K > it's giving me errors. > When I run it under the exe or debug I get a "Run-time error 70. Permission > denied" as it tries to programmatically delete the Word temp files. > When I try to manually delete the Word temp file it gives an "Error deleting > File or Folder: Cannot delete (temp file name). There has been a sharing > violation. The source or destination file may be in use." Read only is not > set. > Task manager shows no open programs or processes for Word or Excel that I > can see. > Since it's running under Virtual PC 2004 I am trying to update that to SP1 > in case that is issue but am getting versioning error(error code 1638 > Error_product-version:Another version of this product is already > installed..etc) on Windows Installer (I have Win XP SP1 so doesn't have the > latest version). But having issues to resolve with that, but not sure the VPC > SP1 is issue or not. > > Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > Thanks God bless > Van Thanks Nick-will check it out.
Blessings Van Show quoteHide quote "NickHK" wrote: > Van, > Not that it will solve your problem, but it might point your to the reason: > http://www.dr-hoiby.com/WhoLockMe/index.php > > NickHK > > > "VanS" <V***@discussions.microsoft.com> wrote in message > news:75E11280-3604-43BB-AD68-4B4526B6CA63@microsoft.com... > > Hello, > > I asked about this before, but am against deadline and haven't received > any > > solutions yet, so thought would try again. > > I have an app that uses a VB6 front end to an Excel/Word VBA app.When the > vb > > part starts up it searches for Excel, Word and VB temp files and deletes > > them. This has worked fine before including on my Win XP SP1 Pro/Office > 2003 > > machine. But when I run it under a Virtual PC testbed of Win 2K/Office 2K > > it's giving me errors. > > When I run it under the exe or debug I get a "Run-time error 70. > Permission > > denied" as it tries to programmatically delete the Word temp files. > > When I try to manually delete the Word temp file it gives an "Error > deleting > > File or Folder: Cannot delete (temp file name). There has been a sharing > > violation. The source or destination file may be in use." Read only is not > > set. > > Task manager shows no open programs or processes for Word or Excel that I > > can see. > > Since it's running under Virtual PC 2004 I am trying to update that to SP1 > > in case that is issue but am getting versioning error(error code 1638 > > Error_product-version:Another version of this product is already > > installed..etc) on Windows Installer (I have Win XP SP1 so doesn't have > the > > latest version). But having issues to resolve with that, but not sure the > VPC > > SP1 is issue or not. > > > > Any idea what wrong or how to fix? Is Win 2K pickier on permissions? > > Thanks God bless > > Van > > >
String Declaration
How big of a difference between VB 6 and .net INT() vs CInt() Best way to build a Code Library Run-time error '13': Type mismatch Monitoring file creations/deletions Compile Error Argument not optional for Parameter.Append VB - Hebrew/Arabic and RTL (RightToLeft) My 64 Bit explorations StatusBar control |
|||||||||||||||||||||||