在win98中如何关机?(100分)

  • 主题发起人 主题发起人 免费得到
  • 开始时间 开始时间

免费得到

Unregistered / Unconfirmed
GUEST, unregistred user!
我看到有不少在win2k中关机的文章,可是在win98中运行却不行,能告诉我在win98中<br>应该如何处理?我并不想免费得到!呵呵。。。[:(!]
 
ExitWindowsEx
 
The ExitWindowsEx function either logs off, shuts down, or shuts down and restarts the system. <br><br>BOOL ExitWindowsEx(<br><br>&nbsp; &nbsp; UINT uFlags, // shutdown operation<br>&nbsp; &nbsp; DWORD dwReserved // reserved<br>&nbsp; &nbsp;); <br>&nbsp;<br><br>Parameters<br><br>uFlags<br><br>Specifies the type of shutdown. This parameter must be some combination of the following values: <br><br>Value &nbsp; &nbsp; &nbsp; Meaning<br>EWX_FORCE &nbsp; &nbsp; &nbsp; Forces processes to terminate. When this flag is set, Windows does not send the messages WM_QUERYENDSESSION and WM_ENDSESSION to the applications currently running in the system. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.<br>EWX_LOGOFF &nbsp; &nbsp; &nbsp; Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.<br>EWX_POWEROFF &nbsp; &nbsp; &nbsp;Shuts down the system and turns off the power. The system must support the power-off feature.Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.<br>EWX_REBOOT Shuts &nbsp;down the system and then restarts the system. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.<br>EWX_SHUTDOWN &nbsp; &nbsp; &nbsp;Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.<br>&nbsp;<br><br>dwReserved<br><br>Reserved; this parameter is ignored. <br><br>&nbsp;<br><br>Return Values<br><br>If the function succeeds, the return value is nonzero.<br>If the function fails, the return value is zero. To get extended error information, call GetLastError. <br><br>
 
ShellExecute(Handle,'open','rundll.exe','user.exe,exitwindows',nil,SW_SHOWNORMAL)<br>
 
同意:)
 
ExitWindowsEx(EWX_SHUTDOWN,0)
 
ExitWindowsEx(EWX_SHUTDOWN,0);//关机<br>ExitWindowsEx(EWX_REBOOT,0);//重启<br>我一直这么用<br>
 
谢谢楼上的两位,不过如果你们能测试一下再说,我会更加高兴的!<br>OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) ;<br>在2k中运行没问题,可在98中就不行,各位看看好吗?
 
各位能让我看看完整的调用吗?我不太明白。<br>
 
program ShutDownWin98;<br>uses<br>&nbsp; Windows,forms;<br>{$R *.RES}<br>begin<br>&nbsp; Application.Initialize;<br>&nbsp; Application.Run;<br>&nbsp; ExitWindowsEx(EWX_SHUTDOWN,0);<br>end.<br>
 
各位大哥你们的这个问题好像会和我的那个问题比较相似,麻烦各位在解决此问题<br>的同时也帮我看看我的问题好吗![:)]<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=654256
 
后退
顶部