我编了一个自动关机程序,用了InitiateSystemShutdown和ExitWindowsEx函数,
机器不锁定时程序运行正常,
在机器锁定的时候就出错了,该怎么办呢?
谢谢了

解决方案 »

  1.   

    机器锁定?
    More detail!How you lock the machine!
      

  2.   

    win2000下不是有锁定状态吗?我的程序要后台运行,定时关机,可是由于2000下个一段时间没有操作可能进入锁定状态,导致没有权限关机,请问如何解除锁定,或者获取其权限。
      

  3.   

    应该有一个以什么用户来运行程序的
    还有一个就是程序的权限问题
    OpenProcessToken
    AdjustTokenPrivileges
    以上是要用到的函数,可以调整程序运行特权
      

  4.   

    这是win2000的一个BUG:在屏幕保护(带密码的)启动时,关机函数不能在锁定状态正确执行,把屏保禁止了就可以了
      

  5.   

    this is a bug:
    Calling ExitWindowsEx() may not completely log off the currently logged on user in a workstation locked state. This happens if the workstation is locked manually by a user and ExitWindowsEx() is called while a screen saver is also running on the system. 
    for more detais,see MSDN articles;
    BUG: ExitWindowsEx() May Not Logoff in a Workstation Locked State 
    ID: Q229750