Re: Shell or ShellExecute powercfg.cpl doesn't fire
- From: "MikeD" <nobody@xxxxxxxxxxx>
- Date: Mon, 15 Aug 2005 15:22:45 -0400
"Ted" <2000@xxxxxxxxxx> wrote in message
news:u$Uq%23jcoFHA.1048@xxxxxxxxxxxxxxxxxxxxxxx
>> lRetVal = ShellExecute(0, "open", GS$ & "powercfg.cpl", vbNullString,
>> vbNullString, 1)
>
> Still no luck
>
> Err.LastDllError comes back 1155
> lRetVal comes back 31
A return value of 31 for ShellExecute means no association with the given
file extension. As far as I know, ShellExecute does not use SetLastError,
so the value assigned to Err.LastDllError is probably meaningless (i.e. it's
the value from an API function called before ShellExecute). Why ShellExecute
is returning 31, I don't know. I looked up its association in the Registry
and the shell command was "rundll32.exe shell32.dll,Control_RunDLL "%1",%*".
In any case, try this and see if you get any better luck:
Shell "rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl", vbNormalFocus
You should be able to use that same command line with ShellExecute, but I
really don't see any reason to do so.
--
Mike
Microsoft MVP Visual Basic
.
- References:
- Re: Shell or ShellExecute powercfg.cpl doesn't fire
- From: Bob Butler
- Re: Shell or ShellExecute powercfg.cpl doesn't fire
- From: Bob Butler
- Re: Shell or ShellExecute powercfg.cpl doesn't fire
- Prev by Date: Add code to play audio file
- Next by Date: soft keypad for headless installation
- Previous by thread: Re: Shell or ShellExecute powercfg.cpl doesn't fire
- Next by thread: Re: Shell or ShellExecute powercfg.cpl doesn't fire
- Index(es):
Relevant Pages
|