Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Launching Add/Remove Programs in Vista

8 views
Skip to first unread message

Defect Architect

unread,
May 8, 2006, 9:40:02 PM5/8/06
to
I am trying to launch Add/Remove Programs by running ShellExecuteEx with
"appwiz.cpl". This works fine on XP but not on Vista. Does anybody know how
to launch Add/Remove Programs programmatically in Vista?

Jim Barry

unread,
May 9, 2006, 7:48:18 AM5/9/06
to

Does "control appwiz.cpl" work?

--
Jim Barry, MVP (Windows SDK)

David Lowndes

unread,
May 9, 2006, 9:02:56 AM5/9/06
to
>> I am trying to launch Add/Remove Programs by running ShellExecuteEx
>> with "appwiz.cpl". This works fine on XP but not on Vista. Does
>> anybody know how to launch Add/Remove Programs programmatically in
>> Vista?
>
>Does "control appwiz.cpl" work?

FWIW, it works with ShellExecute(Ex) or via control for me on the
current Vista beta.

Dave

Jim Barry

unread,
May 9, 2006, 1:05:10 PM5/9/06
to
David Lowndes wrote:
> FWIW, it works with ShellExecute(Ex) or via control for me on the
> current Vista beta.

Hmmm, maybe the .cpl file class on the OP's Vista system is messed up.

David Lowndes

unread,
May 9, 2006, 3:53:42 PM5/9/06
to
>> FWIW, it works with ShellExecute(Ex) or via control for me on the
>> current Vista beta.
>
>Hmmm, maybe the .cpl file class on the OP's Vista system is messed up.

...or there's some verb configuration that's subtly different?

A sample code snippet would help.

Dave

Defect Architect

unread,
May 9, 2006, 6:53:02 PM5/9/06
to
Here's the code:

SHELLEXECUTEINFO s;
s.cbSize = sizeof(s);
s.fMask = 0;
s.hwnd = NULL;
s.lpVerb = NULL;
s.lpFile = _T("appwiz.cpl");
s.lpParameters = NULL;
s.lpDirectory = NULL;
s.nShow = SW_SHOW;
ShellExecuteEx(&s);

I can't get this to work on a 64-bit version of Vista build 5365.

"David Lowndes" wrote:

> >> FWIW, it works with ShellExecute(Ex) or via control for me on the
> >> current Vista beta.
> >
> >Hmmm, maybe the .cpl file class on the OP's Vista system is messed up.
>

> ....or there's some verb configuration that's subtly different?

David Lowndes

unread,
May 9, 2006, 7:41:56 PM5/9/06
to
>I can't get this to work on a 64-bit version of Vista build 5365.

Does it work on the x86 Vista build for you?

I can't install the x64 Vista to try it (stupid signed driver
requirement) :(

Is this a Win64 program or Win32 one?

Dave

Defect Architect

unread,
May 9, 2006, 9:01:02 PM5/9/06
to
This is a 32-bit app. It does not work on the x86 version for me either.

David Lowndes

unread,
May 10, 2006, 2:47:39 AM5/10/06
to
>This is a 32-bit app. It does not work on the x86 version for me either.

OK in that case all I can suggest is to get the later beta version
5381, that seems to be OK for me.

I'm testing with my ShellExec test program
http://www.jddesign.f2s.com/freeware_programs.htm#ShellExec which lets
me exercise the ShellExecute(Ex) APIs using essentially the code you
showed (null verb). You could always download that and give it a try
as a check against your code.

Dave

Paul Baker [MVP, Windows - Networking]

unread,
May 10, 2006, 9:21:56 AM5/10/06
to
I do not have an installation of Vista. However, there are important
troubleshooting steps that you should be taking that may resolve the issue.

The first step is to clarify what you mean when you say that it doesn't
work. Do you see any error message and, if so, what is the message? What is
the result of the ShellExecuteEx function? What is the value of s.hInstApp
after the call to ShellEexeucteEx.

You are not initializing all members of the SHELLEXECUTEINFO structure. This
is bad practice and will likely cause sporadic errors. You should call
ZeroMemory to initialize the structure. After that, you don't need to set
anything to 0 or NULL, just set the members that are not 0 or NULL.

Does appwiz.cpl exist in your installation of Vista? Is its existance
documented anywhere because, if not, Microsoft may choose to remove it
(though I doubt it). You set lpVerb to NULL. This means that it will use the
default verb. If you right-click on appwiz.cpl, what is the default verb
(its menu item is in bold). Hopefully, it is 'open'. Does choosing this menu
item have the effect you intend? If not, then the call to ShellExecuteEx
won't either.

Paul

"Defect Architect" <DefectA...@discussions.microsoft.com> wrote in
message news:A4BA645B-FDBB-47FA...@microsoft.com...

Defect Architect

unread,
May 10, 2006, 2:17:02 PM5/10/06
to
ShellExecuteEx does not display any error message.
It is returning success.
hInstApp is equal to 42.
I have initialized the structure using ZeroMemory.
appwiz.cpl is located in windows\system32 and windows\syswow64.
I have explicitly tried running it from both folders.
The default verb is "Open with Control Panel".

Defect Architect

unread,
May 10, 2006, 2:33:01 PM5/10/06
to
Hi Dave,

I tried your app. It does not seem to be working for me either. Thanks.

David Lowndes

unread,
May 10, 2006, 4:17:17 PM5/10/06
to
>I tried your app. It does not seem to be working for me either. Thanks.

Assuming no mistakes in that app (I sincerely hope there aren't any),
then it would point towards some configuration issue on that Vista
installation - or a quirk with that build. All I can suggest is to try
a clean installation of the latest build.

Dave

Paul Baker [MVP, Windows - Networking]

unread,
May 10, 2006, 5:32:47 PM5/10/06
to
Perhaps you can post your new code so that we can verify it.

I would try to eliminate some things as a possibility. Try it on 32-bit
Windows Vista. Try it on Windows XP Service Pack 2. Try a fully-qualified
path to the 32-bit appwiz.cpl (C:\windows\system32\appwiz.cpl).

Paul

"Defect Architect" <DefectA...@discussions.microsoft.com> wrote in

message news:6BF5A554-BF64-4216...@microsoft.com...

Defect Architect

unread,
May 10, 2006, 6:36:01 PM5/10/06
to
Here is the code:

SHELLEXECUTEINFO s;
ZeroMemory(&s, sizeof(s));


s.cbSize = sizeof(s);
s.fMask = 0;
s.hwnd = NULL;
s.lpVerb = NULL;
s.lpFile = _T("appwiz.cpl");
s.lpParameters = NULL;
s.lpDirectory = NULL;
s.nShow = SW_SHOW;
ShellExecuteEx(&s);

Windows XP SP2: Works fine.
Vista 5308 32-bit: Doesn't work.
Vista 5365 64-bit: Doesn't work.

I have tried fully qualified paths to system32\appwiz.cpl and
syswow64\appwiz.cpl. I have also tried calling "control.exe appwiz.cpl" with
ShellExecuteEx and CreateProcess. I have also tried "rundll32.exe
shell32.dll,Control_RunDLL appwiz.cpl" with ShellExecuteEx and CreateProcess.
I have tried different values for nShow. All these tests have been on clean
images. I have not been able to get it to work with Dave's ShellExecute test
program either.

Paul Baker [MVP, Windows - Networking]

unread,
May 11, 2006, 9:49:03 AM5/11/06
to
Wow.

Let's stick to the 32-bit Windows Visata for now.

Can you please post your code for CreateProcess using the command line
"rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl" so we can see the exact
parameters.

What is the return value of CreateProcess? If it is FALSE, what is the
result of GetLastError?

You can use Process Explorer to see if the RUNDLL32 process actually starts.

You confirmed that right-clicking the CPL file in Explorer and choosing
'Open in Control Panel' worked, right?

Paul

"Defect Architect" <DefectA...@discussions.microsoft.com> wrote in

message news:D54FD575-6FBF-4937...@microsoft.com...

Paul Baker [MVP, Windows - Networking]

unread,
May 11, 2006, 10:08:13 AM5/11/06
to
I forgot to post the URL for Process Explorer, a free utility from
Sysinternals:
http://www.sysinternals.com/Utilities/ProcessExplorer.html

Use the View | Update speed sub-menu to use the most frequent update speed
and look for processes add (highlighted in green) and removed (highlighted
in red).

You may see RUNDLL32 added and removed, or you may see it added and running
for an extended period of time.

Paul

"Paul Baker [MVP, Windows - Networking]" <pa...@online.rochester.rr.com>
wrote in message news:O3ycrGQd...@TK2MSFTNGP03.phx.gbl...

Defect Architect

unread,
May 12, 2006, 7:58:02 PM5/12/06
to
This issue seems to have gone away with Vista build 5381. Thanks for all
your help.

-DA

Paul Baker [MVP, Windows - Networking]

unread,
May 15, 2006, 9:33:23 AM5/15/06
to
Aha, excellent :)

"Defect Architect" <DefectA...@discussions.microsoft.com> wrote in

message news:154BB1EF-610D-4328...@microsoft.com...

Gilou

unread,
Jul 14, 2006, 3:06:02 PM7/14/06
to

"Defect Architect" wrote:

Hello,
I experience similar problem using WinXP pro x64 edition.
If I try to launch a program located in C:\Windows\System32 from a 32-bit
program, Windows raises an error dialog box to tell me that the file does not
exist.
When I do the same but from a 64-bit version of my program, I don't have the
error.
I suspect ShellExecute to parse the filename and replace "system32" by
"SysWOW64", but perhaps I'm wrong.

0 new messages