WINDOWNS 2000关机问题(老问题)(100分)

  • 主题发起人 lausunny
  • 开始时间
你自己调试一下啦,就是这个,可以关本地,不可以关远程<br>不过你可以在调用关机之前,先登陆远程机(知道密码、账号<br>去映射网络驱动器就行啦)<br>9X 就不用说了吧,兄弟们都是大虾吗,干吗生气,呵呵,求财,<br>求和气,哦,对啦,我还求分! 只是可惜分太少啦。<br><br>const<br>&nbsp; DllName = 'Advapi32.dll';<br>{<br>&nbsp; 1、<br>&nbsp; &nbsp; BOOL InitiateSystemShutdownEx(<br>&nbsp; &nbsp; &nbsp; LPTSTR lpMachineName, &nbsp; &nbsp; &nbsp; // computer name<br>&nbsp; &nbsp; &nbsp; LPTSTR lpMessage, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // message to display<br>&nbsp; &nbsp; &nbsp; DWORD dwTimeout, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// length of time to display<br>&nbsp; &nbsp; &nbsp; BOOL bForceAppsClosed, &nbsp; &nbsp; &nbsp;// force closed option<br>&nbsp; &nbsp; &nbsp; BOOL bRebootAfterShutdown, &nbsp;// reboot option<br>&nbsp; &nbsp; &nbsp; DWORD dwReason &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// shutdown reason<br>&nbsp; &nbsp; );<br>&nbsp; 2、<br>&nbsp; &nbsp; BOOL AbortSystemShutdown(<br>&nbsp; &nbsp; LPTSTR lpMachineName &nbsp; // computer name<br>&nbsp; &nbsp; );<br>}<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; AbortSystemShutdown('10.97.0.138');<br>end;<br><br>function TForm1.ControlWin2K: Boolean;<br>var<br>&nbsp; GetDll: HWND;<br>&nbsp; InitiateSystemShutdownExA: function(<br>&nbsp; &nbsp; lpMachineName, lpMessage: string;<br>&nbsp; &nbsp; dwTimeout: DWord;<br>&nbsp; &nbsp; bForceAppsClosed, bRebootAfterShutdown: Boolean;<br>&nbsp; &nbsp; dwReason: DWord<br>&nbsp; &nbsp; ): Integer; stdcall;<br>begin<br>&nbsp; &nbsp;GetDll := LoadLibrary(DllName);<br>&nbsp; &nbsp; if GetDll = 0 then<br>&nbsp; &nbsp; &nbsp; raise Exception.Create('加载Advapi32.dll出错,程序异常终止!');<br>&nbsp; &nbsp; @InitiateSystemShutdownExA := GetProcAddress(GetDll,<br>&nbsp; &nbsp; &nbsp; 'InitiateSystemShutdownExA');<br>&nbsp; &nbsp; if @InitiateSystemShutdownExA &lt;&gt; nil then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; InitiateSystemShutdownExA('10.97.0.138', 'hi', 3000,<br>&nbsp; &nbsp; &nbsp; &nbsp; True, True, 0);<br>&nbsp; &nbsp; end;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; ControlWin2K;<br>end;<br>
 
顶部