首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

ExitWindowsEx()这个关机函数,有时电脑关不了哦解决办法

2012-05-22 
ExitWindowsEx()这个关机函数,有时电脑关不了哦可能是程序开的比较多然后执行这个函数就关不了机不过如果

ExitWindowsEx()这个关机函数,有时电脑关不了哦
可能是程序开的比较多
然后执行这个函数就关不了机

不过如果我把程序关的差不多了,还是可以的
我的是XP
具体写法是:ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF,0); 

不知道有什么更好的方法吗?就是即使程序很多,最后还是能达到关机的目的

[解决办法]
ExitWindowsEx
The ExitWindowsEx function either logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.
//这里说到他将终止all applications 

During a shutdown or log-off operation, applications that are shut down are allowed a specific amount of time to respond to the shutdown request. If the time expires, the system displays a dialog box that allows the user to forcibly shut down the application, to retry the shutdown, or to cancel the shutdown request. If the EWX_FORCE value is specified, the system always forces applications to close and does not display the dialog box. 
//这段说到他在固定时间内applications that are shut down are allowed 
//一旦超时,会弹出一个对话跨能够进行选择强制关闭程序还是重试还是取消
//当EWX_FORCE被设置时,系统会强制关闭 applications 

原因可能就是因为程序多,超时了
看看能不能把时间设置长点,不然就EWX_FORCE

热点排行