Windos XP/2000 reboot

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
 
H

Herfried K. Wagner [MVP]

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>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top