关于用Exitwindowsex() 函数 我用此函数想让什么也不提示就关机。 用 EWX_SHUTDOWN 参数还提示有用户连接到我的机子上用EWX_FORCE 参数弹出登录窗口。 我的机子是win98 请问怎么让它什么也不提示. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 InitiateSystemShutdown(0, 0, 0, TRUE, FALSE); 是不是在exitwindowsex函数前调用initiatesystemshutdown函数呀。exitwindowsex最好用什么参数。 void ForceCloseWindow(){HANDLE hToken; TOKEN_PRIVILEGES tkp; // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) AfxMessageBox("OpenProcessToken"); // 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) AfxMessageBox("AdjustTokenPrivileges"); // Shut down the system and force all applications to close. if (!ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0)) AfxMessageBox("ExitWindowsEx"); } to wuchuncai(1234567) 我用了你的代码,OpenProcessToken用getlasterroe返回 This function is not supported on this system. 是怎么回事 to ndy_w(carpe diem) InitiateSystemShutdown(0, 0, 0, TRUE, FALSE);我用你的函数什么也没做也没关机。 我用的是win2000,对于win98你看看有没有替代的函数 用CAsyncSocket接收多个端口数据时出现的错误。 请教MFC的打印问题。 哪位用过pwlib库??? 怎莫显示自创字符 大虾有没有支持创天中文vc6.0的visual assist? 关于分割窗口createview的问题 怎样在CHECK BOX 的表面像CBitmapButton帖图片? 程序中能设置ODBC吗? ontimer 函数问题 怎样编译apispy,既有.asm文件,又有cpp文件 MSDN一呼出就出错,等待解答,CLR 关于closehandle()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
AfxMessageBox("OpenProcessToken");
// 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)
AfxMessageBox("AdjustTokenPrivileges");
// Shut down the system and force all applications to close.
if (!ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0))
AfxMessageBox("ExitWindowsEx"); }
This function is not supported on this system.
是怎么回事