C# Windows CE 5.0 错误:无法在 PInvoke DLL coredll 中找到入口点 ExitWindowsEx

发布于 2024-10-10 11:14:54 字数 776 浏览 0 评论 0原文

我需要使用 Microsoft.NET SDK CompactFramework v2.0 以编程方式关闭 Windows CE 5.0 平板电脑。我尝试使用此处的解决方案,但收到错误信息

找不到入口点 ExitWindowsEx 在PInvoke DLL coredll中

有没有办法将 ExitWindowsEx 添加到我的构建中? 我需要不同的 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);
}

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);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖粟与秋泊 2024-10-17 11:14:54

您不能只替换 coredll.dll,它是操作系统的一部分。要更改 coredll,您需要一个全新的操作系统。

也就是说,尚不清楚您是否需要一个。 ExitWindowsEx 可能不是您想要进行的调用(CE 中不支持它),但您可能应该调用 KernelIoControl 与 IOCTL_HAL_REBOOT 进行软重置。

实际上没有标准的“关闭电源”,因此如果您确实需要关闭电源,请咨询您的 OEM。但是,有一个设备挂起模式(假设它位于您的特定操作系统中)。可以通过 P/Invoking 以编程方式实现暂停 GwesPowerOffSystem< /a> 或将 VK_OFF 键发布到键盘流。

You can't just swap out coredll.dll, it's part of the OS. To change coredll, you need an entirely new OS.

That said, it's not clear that you need one. ExitWindowsEx is likely not the call you want to be making (it's not supported in CE), but instead you probably should be calling KernelIoControl with IOCTL_HAL_REBOOT for a soft reset.

There really is no standard "power off" so if you truly need to shut down power, check with your OEM. There is, however, a device Suspend mode (assuming it's in your specific OS). Suspend can be gotten at programmatically by P/Invoking GwesPowerOffSystem or post a VK_OFF key to the keyboard stream.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文