C# Windows CE 5.0 error: Can't find entry point ExitWindowsEx in PInvoke DLL coredll

Posted by JackN on Stack Overflow See other posts from Stack Overflow or by JackN
Published on 2011-01-04T17:52:27Z Indexed on 2011/01/04 17:53 UTC
Read the original article Hit count: 239

Filed under:
|
|

I need to programatically shutdown a Windows CE 5.0 tablet using Microsoft.NET SDK CompactFramework v2.0. I tried using the solution here but got the error message

Can't find entry point ExitWindowsEx in PInvoke DLL coredll

Is there a way to add ExitWindowsEx to my build? Do I need a different coredll?

[Flags]
public enum ExitFlags
{
    Reboot = 0x02,
    PowerOff = 0x08
}
[DllImport("coredll")]
public static extern int ExitWindowsEx(ExitFlags flags, int reserved);
private static void buttonShutdown_Click(object sender, EventArgs e)
{
    ExitWindowsEx(ExitFlags.PowerOff, 0);
}
private static void buttonRestart_Click(object sender, EventArgs e)
{
    ExitWindowsEx(ExitFlags.Reboot, 0);
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about compact-framework