Re: Shell or ShellExecute powercfg.cpl doesn't fire



"Ted" <2000@xxxxxxxxxx> wrote in message
news:%23fCyvaboFHA.1044@xxxxxxxxxxxxxxxxxxxx
>> does GS$ end with a trailing "\"? Yes
>
> >Have you tried using vbNullString instead
>> of "" for the parameters/directory?
> This does not work
> lRetVal = ShellExecute(0, "Open", GS$ & "powercfg.cpl", vbNullString,
> "", 1)
>
>> You should also post you Declare statement for the ShellExecute call.
>
> Option Explicit
> Private Declare Function ShellExecute Lib "shell32.dll" Alias
> "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String,
> ByVal lpFile As String, ByVal lpParameters As String, ByVal
> lpDirectory As String, ByVal nShowCmd As Long) As Long

Don't see anything obviously wrong unless it is the lpDirectory; try
lRetVal = ShellExecute(0, "open", GS$ & "powercfg.cpl", vbNullString,
vbNullString, 1)

and check the values of lRetVal and Err.LastDllError to see what, if any,
error code is coming back



--
Reply to the group so all can participate
VB.Net: "Fool me once..."

.



Relevant Pages


Loading