Jump to content

Smartphone 2003 shutdown


Guest mrsenang

Recommended Posts

Guest mrsenang

:) hiii, im a newbie for programming on windows ce base smartphone

can anybody help me for to make code script turnoff device on smatrtphone with vb.net or c#.net

plsss help

many thanks!!! :D :D

Link to comment
Share on other sites

Guest mrsenang

hiiii i used this code on my programm to turnoff the device on smartphone 2003:

'

Public Declare Sub GwesPowerOffSystem Lib "Coredll" ()

Private Sub ShutDown()

If MsgBox("Shutdown device now?", vbYesNo, "Shutdown") = vbNo Then Exit Sub

GwesPowerOffSystem

End Sub

'

but when i compiled this code debuger say "GwesPowerOffSystem" <

Link to comment
Share on other sites

Guest mgama

You can use p/invoke to call ExitWindowsEx from C#. Towards the end of the Google thread, they provide the function definition. It should look a little something like this (I haven't tested it):

[DllImport("user32.dll")]

static extern bool ExitWindowsEx(uint flags, uint reason);

// Flags: (just a few of the flags defined in winuser.h)

const uint EWX_SHUTDOWN = 0x00000001;

const uint EWX_REBOOT = 0x00000002;

// Reasons (just a few of the reasons defined in Reason.h)

const uint SHTDN_REASON_MAJOR_OTHER 0x00000000

const uint SHTDN_REASON_MAJOR_NONE 0x00000000

const uint SHTDN_REASON_MAJOR_HARDWARE 0x00010000

const uint SHTDN_REASON_MAJOR_OPERATINGSYSTEM 0x00020000

const uint SHTDN_REASON_MAJOR_SOFTWARE 0x00030000

const uint SHTDN_REASON_MAJOR_APPLICATION 0x00040000

const uint SHTDN_REASON_MAJOR_SYSTEM 0x00050000

const uint SHTDN_REASON_MAJOR_POWER 0x00060000

Edited by mgama
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.