Results 1 to 33 of 33

Thread: shell problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    shell problem

    Hello,

    I'm creating a little program that is uninstalling another program.
    This is done by using the shell command like this:

    shell ("c:\program files\myapp\uninst.exe")

    Now, once the uninstaller finished (checked that using the process list), I have to delete the folder myapp which is in program files.
    Therefor, I'm using fso.deletefolder ("c:\program files\myapp"), but I always receive a permission denied message.

    When I try this command without running the shell command first, it works, so I figure that the shell command keeps blocking the directory. How can I prevent that?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Welcome to the forums.

    Is this the code you are using?
    Code:
    shell ("c:\program files\myapp\uninst.exe")
    fso.deletefolder ("c:\program files\myapp")

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    Thanks :-)

    It's a little more complex ... Let me show ....

    Code:
    Shell "c:\program files\myapp\uninst.exe", vbNormalFocus
    
    For Each process In GetObject("winmgmts:").execquery("Select Name from Win32_Process Where Name = 'uninst.exe' Or Name ='_iu14D2N.tmp'")
    bfound = True
    Next
    While bfound
    bfound = False
    For Each process In GetObject("winmgmts:").execquery("Select Name from Win32_Process Where Name = 'uninst.exe' Or Name ='_iu14D2N.tmp'")
    bfound = True
    Next
    Wend
    If bfound = False Then
    fso.DeleteFolder ("c:\Program Files\myapp")
    End If

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    An uninstall should remove folders too unless there are custom user created files in it or an open process.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    It would depend on who made the uninstaller.

    I'm thinking that the reason the error is occuring is because the uninstaller is still running when you are attempting to delete the folder.

    As a test, make is two step process. Run your uninstaller, and then run the delete folder code from a button that you click after the uninstaller is done.

    I'm almost willing to bet it will work.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    There are user created files in it, which are not deleted...

    The goal is to perform a complete reinstall with auto backups of certain files.

    Hack: I tried that already, and it does not solve the problem.

    Example:

    1) I open my program and run the uninstaller from button 1. The uninstaller has quit and I push button 2 to delete the folder: runtime error 70 access denied.

    2) I open my program and run the uninstaller. I close my program.
    I open my program again and push button 2: folder deleted.

    How strange is that

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    Well it looks like the looping of processes is incorrect as that could be a reason why its trying to delete when its still running.

    Looks like it will exit and bfound will always be True so it will bypass the delete line.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Quote Originally Posted by KI2000
    Hack: I tried that already, and it does not solve the problem.
    Now you see why I'm not a betting man.
    Quote Originally Posted by KI2000
    2) I open my program and run the uninstaller. I close my program.
    I open my program again and push button 2: folder deleted.
    What cleanup are you doing when you close the program? What is in the Unload event?

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    Perhaps it would be better to test against the execquery results being 1 or more. If so then its still running. If not then its not and the delete can take place.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    RobDog888: bfound is not always true, it tries to delete the folder after the uninstaller quits, that's the moment I receive that damn runtime error 70 ...

    Hack: There's nothing in the unload event of that program at the moment ...

    Maybe you guys could try my code yourself?

    BTW: is there another way to call the uninstaller of the program (next to the shell command)

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    vb Code:
    1. While bfound
    2.     bfound = False
    3.     For Each process In GetObject("winmgmts:").execquery("Select Name from Win32_Process Where Name = 'uninst.exe' Or Name ='_iu14D2N.tmp'")
    4.         bfound = True 'ON LAST ITERATION IT WILL STILL BE TRUE
    5.     Next
    6. Wend
    7.  
    8. 'THEN IT WILL BYPASS BECAUSE ITS TRUE AND NOT FALSE
    9. If bfound = False Then
    10.     fso.DeleteFolder ("c:\Program Files\myapp")
    11. End If
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    RobDogg: Explain that to me ... I'm putting bfound = false in the loop. So when the process is no longer there, bfound should stay false ... Of course, that's only my opinion and I'm not an expert

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    No, my mistake I think. Been really sick this week.
    If bfound is really false then when it deletes the folder it should unless its a timming issue where the os has not completely released the resources linked in the folder for a few seconds after the process has exited.

    Try placing a delay and see if that helps or if like already suggested, run just the delete part separately to test for functionality.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    No problem RobDogg ... Hope you get well soon ...

    I already tried with a delay of 10 seconds ... Still same problem.

    What I was thinking: Isn't it possible that the shell command somehow locks the directory?

  15. #15
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Try
    Code:
    fso.deletefolder ("c:\program files\myapp"), True

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    tried it, same problem

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    Dont you have to have a empty folder before you can delete it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    It's not necessary with the fso.deletefolder command imho.

    The kill command however won't work until the folder is empty. That's why I chose to use fso.deletefolder.

    Is there any way I can kill the shell command myself? Something is definitely happening when I close my program, because afterwards deleting the folder is not a problem.

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    I have seen the VB IDE hold a reference to a access db before. Could be doing the same with a ref on the folder. Can you test this out by compiling and running outside the ide with the ide closed?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Quote Originally Posted by KI2000
    tried it, same problem
    It was a shot in the dark.

    Anyway,
    Quote Originally Posted by KI2000
    Hack: There's nothing in the unload event of that program at the moment ...
    I asked that question because you said that if you run your uninstall, close the program, open it again, then your delete works.

    Closing the program has an affect and I was hoping it was because of some clean up that you were doing that could be done without closing the program.

    So, the question becomes what gets freed up when the program closes?

    I put a text file in a folder, programmatically opened it by shelling notepad, closed it, and then deleted the file and the folder with no problem so I am not convinced Shell is blocking anything.

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    Hope I got this right ... I compiled the program and saved it on another partition of my drive.
    I closed down Visual Basic 6 and ran my program; the same happened: runtime error 70 ... I'm starting to lose it

  22. #22
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Do you always run the uninstall from the same folder?

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    Hmm, ok then it has to be like Hack posted. Something in your program is still holding a resource ink to the folder preventing it from being deleted. Check in the taskmanager if your app is still running, test for a manual delete, and if either of the two fail then thats the area to research.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  24. #24

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    That's the default location of that file.

    I'm going to try (just a test) to put the uninstaller in another folder ... I bet it will work then.

    Just tested something else:
    - I ran my vb app
    - Got the error 70
    - Tried to delete the myapp folder myself
    - Didn't work, got a message telling me that another program is still using the folder

    I'm pretty sure it's the shell command that's doing this weird trick ...


    **** edit ****

    Just tested it by running the uninst file from my c:\ root. Guess what? It worked ... But that doesn't solve the problem of course ... maybe a step closer to the solution ...
    Last edited by KI2000; Mar 8th, 2007 at 02:15 PM.

  25. #25
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    The shell command wont hold the reference but if there is an error uninstalling it may. Manually run the uninstaller and see if you can manually delete the folder. If you cant then the error is in there.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  26. #26

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    RobDogg: Tried that too ... didn't have a problem deleting the folder after uninstalling manually.

    BTW:
    Addition to my previous comment ...

    All I did was change the path in the shell command to c:\uninst.exe.
    Then it worked ...

    ***edit***
    tried again, now it didn't work ... argh!!

    BTW, did I already tell that you guys are great?
    Last edited by KI2000; Mar 8th, 2007 at 02:26 PM.

  27. #27
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    Is it that your original path has space(s) in it as Shell has issues with spaces in paths. You need to wrap the path with an extra set of double quotes.

    Since it runs correctly and deletes properly manually then there is definately a reference holding a lock on the folder.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  28. #28
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: shell problem

    Question: How does the folder get created in the first place if you delete it after running your install?

  29. #29

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    Hack ... I lost you ...

    I'm trying to uninstall a program after it has been installed.

    So the folder is present when the application is installed, and even when the program is deleted using it's default uninstaller.

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    I think I pinpointed the problem to this:

    Code:
    spath = "c:\program files\myapp\afolder\"
    sfilename = Dir(spath & "*.dat")
    Do While sfilename <> "" And sfilename <> "template.dat" And sfilename <> "initial.dat"
    FileCopy spath & sfilename, "C:\Documents and Settings\David\Desktop\" & sfilename
    sfilename = Dir
    Loop

  31. #31
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: shell problem

    How? Is there an error or something? Is that part of the installation process?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  32. #32

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    uninstall process ... The vb program uninstalls another program but makes backups before uninstalling.

    This is part of the backup process used in the vb application that is uninstalling another program ...

    If I outcomment these lines, the myapp folder gets deleted, if I use these lines of code, I get error 70.

    It seems to be to hard without the full code, so here it goes:

    Code:
    Dim fso As FileSystemObject
    
    Private Sub cmdUninstall_Click()
    On Error GoTo err_handler
    
    Dim process As Object
    Dim bfound As Boolean
    
    Set fso = New FileSystemObject
    
    bfound = False
    
    'Text1.Text = "Uninstall started"
    spath = "c:\program files\myapp\folder1"
    sfilename = Dir(spath & "*.txt")
    Do While sfilename <> "" And sfilename <> "generate.txt"
    FileCopy spath & sfilename, "C:\Documents and Settings\David\Desktop\" & sfilename
    sfilename = Dir
    Loop
    'Text1.Text = Text1.Text & vbCrLf & "Backup of userdata succeeded"
    spath = "c:\program files\myapp\folder2"
    sfilename = Dir(spath & "*.ewi")
    Do While sfilename <> "" And sfilename <> "template.ewi" And sfilename <> "initial.ewi"
    FileCopy spath & sfilename, "C:\Documents and Settings\David\Desktop\" & sfilename
    sfilename = Dir
    Loop
    'Text1.Text = Text1.Text & vbCrLf & "Backup of security files succeeded"
    'Text1.Text = Text1.Text & vbCrLf & "Starting uninstaller program"
    
    Shell "c:\program files\myapp\unins000.exe", vbNormalFocus
    
    
    'spath = ""
    'sfilename = ""
    
    For Each process In GetObject("winmgmts:").execquery("Select Name from Win32_Process Where Name = 'unins000.exe' Or Name ='_iu14D2N.tmp'")
    bfound = True
    Next
    While bfound
    bfound = False
    For Each process In GetObject("winmgmts:").execquery("Select Name from Win32_Process Where Name = 'unins000.exe' Or Name ='_iu14D2N.tmp'")
    bfound = True
    Next
    Wend
    If bfound = False Then
    Text1.Text = Text1.Text & vbCrLf & "Uninstaller terminated"
    fso.DeleteFolder ("c:\Program Files\myapp"), True
    Text1.Text = "folder deleted"
    End If
    err_handler:
    Select Case Err.Number
    Case 53: MsgBox "file not found"
    Case 70: MsgBox "Permission denied"
    
    End Select
    
    
    End Sub
    Last edited by KI2000; Mar 8th, 2007 at 03:09 PM.

  33. #33

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    21

    Re: shell problem

    Still can't figure out what's wrong with my code ... anyone else who can help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width