请问在sdk中什么api可以实现关闭计算机功能。 谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 win98关机你可以用ExitWindows和ExitWindowsex但是在win2000以上,你需要先得到系统权限 HANDLE hToken; TOKEN_PRIVILEGES tkp; // Get a token for this process. if ( !OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) ) return FALSE; // Get the LUID for the shutdown privilege. LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; // one privilege to set tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // Get the shutdown privilege for this process. AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); // Cannot test the return value of AdjustTokenPrivileges. if (GetLastError() != ERROR_SUCCESS) return FALSE; // Shut down the system and force all applications to close. if ( !ExitWindowsEx( EWX_POWEROFF | EWX_FORCE, 0) ) return FALSE; return TRUE; vc++ 图像尺度改变 Unhandled exception in CollectData.exe (KERNEL32.DLL):0xC0000005:Access Violation. 用过 StretchDIBits 或 DrawDibDraw 的进来 请教一个特难的VC 6.0连接xp sp2 sdk的问题 关于枚举网上邻居 请教关于系统空闲问题 如何回复? 如何在视图中显示图片?例如显示.jpg或.gif图片,函数,代码都行呀! 用vc++做语音识别,不知道从何做起,请教高人!!! 如何实现慢速播放 如何判断控件的可见性 再来200分(谁能解决,300分敬上,感谢~~~)
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if ( !OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) )
return FALSE;
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
// Cannot test the return value of AdjustTokenPrivileges.
if (GetLastError() != ERROR_SUCCESS)
return FALSE;
// Shut down the system and force all applications to close.
if ( !ExitWindowsEx( EWX_POWEROFF | EWX_FORCE, 0) )
return FALSE;
return TRUE;