-
April 19th, 2002, 08:49 AM
#1
Run Add/Remove Programs from a program
I want to be able via a program, to execute the Add/Remove Programs Utility and select a specific program or programs to remove. In other words make use of a command line types in a batch file, etc. I have not seen anything in documentation that suggest this is possible. Does anyone know?
Thanks
-
April 19th, 2002, 09:13 AM
#2
Re: Run Add/Remove Programs from a program
I'm not sure what you mean by "make use of a command line types in a batch file", but this will bring up the Add/Remove Programs dialog in Win2000:
option Explicit
'Need reference to Microsoft Shell and Automation Controls
private Sub Command1_Click()
Dim sh as Shell
set sh = new Shell
sh.ControlPanelItem ("APPWIZ.CPL")
set sh = nothing
End Sub
-
April 19th, 2002, 09:23 AM
#3
Re: Run Add/Remove Programs from a program
You could download the CRegistry class from http://www.vbaccelerator.com
and then use this code to get the values for the uninstallstring
Dim c as new cRegistry
Dim sKeys() as string, iKeyCount as Long
Dim Uninstall as string
With c
.ClassKey = HKEY_LOCAL_MACHINE
.SectionKey = "Software\Microsoft\windows\currentversion\uninstall"
.EnumerateSections sKeys(), iKeyCount
for iKey = 1 to iKeyCount
.SectionKey = "Software\Microsoft\windows\currentversion\uninstall\" & sKeys(iKey)
.ValueKey = "UninstallString"
.ValueType = REG_SZ
Uninstall = .Value
next iKey
End With
Uninstall will hold the value after every loop
That may get you started
-
April 19th, 2002, 09:27 AM
#4
Re: Run Add/Remove Programs from a program
Thanks. Yes I know about running this I just didn't make myself clear. What I wish to do is be able to select a program to remove from within another program or a script. For example is there somethign like the use of an additionl argument to select the program to remove: sh.ControlPanelItem ("APPWIZ.CPL", "program name")
-
April 19th, 2002, 09:41 AM
#5
Re: Run Add/Remove Programs from a program
Thanks. I went to site you mentioned buit I could not find a reference to the CRegistry class you mentioned not then it turn up using their search tool.
-
April 19th, 2002, 09:42 AM
#6
Re: Run Add/Remove Programs from a program
-
April 19th, 2002, 09:45 AM
#7
Re: Run Add/Remove Programs from a program
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
|