Windos XP/2000 reboot

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
i have problem with rebooting windows


Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias
"InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As
String, ByVal dwTimeout As Int32, ByVal bForceAppsClosed As Long, ByVal
bRebootAfterShutdown As Boolean) As Boolean



sub test
Systemshutdown = InitiateSystemShutdown(Nothing, "rebooting", 30, True,
True)

end sub

during runtme i have error :
A call to PInvoke function Form1::InitiateSystemShutdown' has unbalanced the
stack. This is likely because the managed PInvoke signature does not match
the unmanaged target signature. Check that the calling convention and
parameters of the PInvoke signature match the target unmanaged signature.

Can some one help me ?
Regards
Rudi
 
Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias
"InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage
As String, ByVal dwTimeout As Int32, ByVal bForceAppsClosed As Long, ByVal
bRebootAfterShutdown As Boolean) As Boolean

Your declaration is wrong. I suggest to use the code which can be found at
<URL:http://www.mentalis.org/soft/class.qpx?id=7>.
 
Back
Top