我用此函数想让什么也不提示就关机。
 
用 EWX_SHUTDOWN  参数还提示有用户连接到我的机子上用EWX_FORCE      参数弹出登录窗口。
 我的机子是win98  请问怎么让它什么也不提示.

解决方案 »

  1.   

    InitiateSystemShutdown(0, 0, 0, TRUE, FALSE);
      

  2.   

    是不是在exitwindowsex函数前调用initiatesystemshutdown函数呀。exitwindowsex最好用什么参数。
      

  3.   

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

  4.   

    to wuchuncai(1234567) 我用了你的代码,OpenProcessToken用getlasterroe返回
               This function is not supported on this system. 
    是怎么回事
      

  5.   

    to  ndy_w(carpe diem) InitiateSystemShutdown(0, 0, 0, TRUE, FALSE);我用你的函数什么也没做也没关机。
      

  6.   

    我用的是win2000,对于win98你看看有没有替代的函数