C# Windows CE 5.0 error: Can't find entry point ExitWindowsEx in PInvoke DLL coredll
- by JackN
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);
}