调用ExWindowsEx后,关机时并没有真正关机?

lifg 2003-02-26 02:49:50
调用ExWindowsEx后,关机时并没有真正关机,只是显示“你可以安全关闭你的计算机”的画面,而我的电脑已经开启APM,平时关机是能够关闭电源的。请帮忙解决,十分感谢
...全文
95 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
蒋晟 2003-02-26
  • 打赏
  • 举报
回复
Knowledge Base

PRB: ExitWindowsEx with EWX_LOGOFF Doesn't Work ProperlyPSS ID Number: Q149690

Article Last Modified on 12-9-1999
The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK)
Symptoms
When an application calls ExitWindowsEx with EWX_LOGOFF in Windows 95, the application itself does not exit. Additionally, the use of the EWX_FORCE flag in conjunction with EWX_LOGOFF will cause undefined behavior.

Cause
It is the application's responsibility to terminate itself. However, limitations of the implementation of ExitWindowsEx in Windows 95 require that the application execute the ExitWindowsEx call and terminate itself in a particular way.

Resolution
The most robust way to use ExitWindowsEx with EWX_LOGOFF is to create a separate application that does nothing but call ExitWindowsEx(EWX_LOGOFF, 0) and then exits. This method will work correctly on all platforms that support ExitWindowsEx. This application must be a Windows application or a console application.

Code similar to the following will correctly perform a logoff on all Windows platforms that support ExitWindowsEx:

int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
ExitWindowsEx(EWX_LOGOFF, 0);

return 0;
}

Status
This behavior is by design.

Additional query words:

Keywords: kbOSWinNT400 kbOSWin2000 kbGrpDSUser kbOSWin95 kbOSWin98 kbWndw
Issue Type: kbprb
Technology: kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch
demetry 2003-02-26
  • 打赏
  • 举报
回复
贴一段代码出来,你的OS版本号?

15,467

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧