|
-
Dec 2nd, 2009, 10:12 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Deleting my own exe
I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?
VBNetDude - Thinking Programmatically
By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most! 
-
Dec 3rd, 2009, 04:14 AM
#2
Re: Deleting my own exe
Why prevent people from uninstalling your application ( which is the way installing & uninstalling programs usually work ) ¿
VB.NET MVP 2008 - Present
-
Dec 3rd, 2009, 04:35 AM
#3
Hyperactive Member
Re: Deleting my own exe
I think he's talking about actually uninstalling the application...
Just a guess: You could add an item in the "RunOnce" registry key that will delete the uninstaller when the system reboots... I don't know if this would work, but the command seems to be pretty simple:
Code:
del c:\path\app.exe /y
-
Dec 3rd, 2009, 05:48 AM
#4
Re: Deleting my own exe
that command actually will flash a black command window on the screen, convincing a lot of users they have spyware. Not that it isn't mostly correct, but you "may" have to call cmd.exe and pass the rest as a parameter, as del doesn't actually exist as a file to run.
-
Dec 3rd, 2009, 05:53 AM
#5
Re: Deleting my own exe
 Originally Posted by BillGeek
I think he's talking about actually uninstalling the application...
Just a guess: You could add an item in the "RunOnce" registry key that will delete the uninstaller when the system reboots... I don't know if this would work, but the command seems to be pretty simple:
Code:
del c:\path\app.exe /y
This work ONLY if the user is connected with Administrator credentials, otherwise you haven't access to Registry.
-
Dec 3rd, 2009, 06:01 AM
#6
Re: Deleting my own exe
 Originally Posted by VBNetDude
I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?
This mean? Mean that your program:
1 - get all References used by program that you want unistall?
2 - decrease the counter references correctly?
3 - un-register references if and only if no longer used by any other programs?
4 - delete references-file if and only if where no longer used (see 3)?
5 - save (not uninstall) references-file used by system?
6 - remove all files installed from original application setup?
7 - remove folder created from original application setup?
8 - ...........
-
Dec 3rd, 2009, 12:10 PM
#7
Thread Starter
Addicted Member
Re: Deleting my own exe
 Originally Posted by gibra
This mean? Mean that your program:
1 - get all References used by program that you want unistall?
2 - decrease the counter references correctly?
3 - un-register references if and only if no longer used by any other programs?
4 - delete references-file if and only if where no longer used (see 3)?
5 - save (not uninstall) references-file used by system?
6 - remove all files installed from original application setup?
7 - remove folder created from original application setup?
8 - ...........

Yes. I have actually done all the dirty work. Now I just have one executable running. That is the uninstaller. I want to remove that uninstaller as well. This way ALL of the files are removed (even the uninstaller) So......
8 - Remove uninstaller executable by either registry 'RunOnce' of some other method.
VBNetDude - Thinking Programmatically
By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most! 
-
Dec 3rd, 2009, 11:34 PM
#8
Re: Deleting my own exe
I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?
If you use InnoSetup to create a Package then you don't need to create an uninstaller or worry about it being running after you uninstall it. It takes care of everything...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Dec 4th, 2009, 12:06 AM
#9
Re: Deleting my own exe
 Originally Posted by koolsid
If you use InnoSetup to create a Package then you don't need to create an uninstaller or worry about it being running after you uninstall it. It takes care of everything...
While I've never used it and I'm sure it's as good as you say, I will be very disappointed if this thread is ended here because of it. Ya, gotta admit that this is an interesting topic and a VB based solution would make it even more so.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Dec 4th, 2009, 04:59 AM
#10
Re: Deleting my own exe
the correct way is placing a command the system itself will run when it feels like it. Runonce is usually the place and some programs such as spybot actually use a shelled del command. Personally i don't like that because of the black screen you get, but it doesn't leave ANY traces behind.
as for administrator privelages someone else was going on about... an uninstaller program MUST have admin privelages or windows won't let the program be uninstalled anyway. Prevents limited users from screwing up a system.
-
Dec 4th, 2009, 07:07 AM
#11
Member
Re: Deleting my own exe
1) try to use a .BAT or
2) try to use something like "unlock opened files".
Good luck
-
Dec 4th, 2009, 03:20 PM
#12
Thread Starter
Addicted Member
Re: Deleting my own exe
 Originally Posted by h2so4
2) try to use something like "unlock opened files".
How would I do that?
VBNetDude - Thinking Programmatically
By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most! 
-
Dec 4th, 2009, 04:16 PM
#13
Re: Deleting my own exe
Here's code that deletes an exe from the Form_Unload of that exe. You can probably adapt it to your purpose.
BTW, I sent you a PM yesterday that you haven't reponded to yet.
Code:
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\del.bat" For Output As #1
Print #1, ":start"
Print #1, "@echo off"
Print #1, "cls"
Print #1, "del " & Chr$(34) & App.Path & "\" & App.EXEName & ".exe" & Chr$(34)
Print #1, "if exist " & Chr$(34) & App.Path & "\" & App.EXEName & ".exe" & Chr$(34) & " goto start"
Print #1, "del " & Chr$(34) & App.Path & "\" & "del.bat" & Chr$(34)
Close #1
Shell App.Path & "\" & "del.bat"
End Sub
-
Dec 4th, 2009, 04:57 PM
#14
Thread Starter
Addicted Member
Re: Deleting my own exe
Thanks, I will try that!
Oh, and the PM... meant to take care of that... Sorry!
EDIT:
There you go!
VBNetDude - Thinking Programmatically
By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most! 
-
Dec 4th, 2009, 05:54 PM
#15
Re: Deleting my own exe
 Originally Posted by MartinLiss
Here's code that deletes an exe from the Form_Unload of that exe. You can probably adapt it to your purpose.
Martin, that code is just very clever. Gonna bookmark this.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Dec 5th, 2009, 02:43 AM
#16
Re: Deleting my own exe
Sorry for the initial confusion VBNetDude, I didn't read properly
VB.NET MVP 2008 - Present
-
Dec 5th, 2009, 11:35 AM
#17
Thread Starter
Addicted Member
Re: Deleting my own exe
 Originally Posted by HanneSThEGreaT
Sorry for the initial confusion VBNetDude, I didn't read properly 
Ha! I have done it a few times as well!
Edit: The Code from MartinLiss Works Great! Thankyou so much!
Last edited by VBNetDude; Dec 5th, 2009 at 02:38 PM.
VBNetDude - Thinking Programmatically
By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|