如何远程控制局域网内的某一台电脑开关机等?

youou 2003-05-21 02:23:26
希望大家能多谈谈...谢谢~
...全文
2262 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
youou 2003-05-23
  • 打赏
  • 举报
回复
呵~~
用INDY好了..

谢谢大家....
jpyc 2003-05-21
  • 打赏
  • 举报
回复
up
角落的青苔 2003-05-21
  • 打赏
  • 举报
回复
to firetoucher:呵呵,偶看着星星好眼红哦~~~在水园没水灌了,只好来这里灌^_*
firetoucher 2003-05-21
  • 打赏
  • 举报
回复
cornermoss好努力哦:)
我也象征性的灌点:)
建议直接用socket通信,
退出系统的函数:

ExitWindowsEx
The ExitWindowsEx function either logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.

BOOL ExitWindowsEx(
UINT uFlags, // shutdown operation
DWORD dwReserved // reserved
);

Parameters
uFlags
Specifies the type of shutdown. This parameter must include one of the following values: Value Meaning
EWX_LOGOFF Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.
EWX_POWEROFF 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.

EWX_REBOOT Shuts 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.

EWX_SHUTDOWN 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.



This parameter can optionally include the following values: Value Meaning
EWX_FORCE Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.
EWX_FORCEIFHUNG Windows NT 5.0 and later: Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if EWX_FORCE is used.



dwReserved
Reserved; this parameter is ignored.

角落的青苔 2003-05-21
  • 打赏
  • 举报
回复
关机就好办了,我是用的UDP,教师机给学生机发送一串字符串,学生机判断该字符串;
如果代表关机,它就winexec关机的命令就行了
不过可能UDP之间通讯不是很好~~
角落的青苔 2003-05-21
  • 打赏
  • 举报
回复
要有网卡,BIOS要支持网络唤醒,好像只能一台一台的启~~
而且受控方要正常关机才行~~郁闷极了
//取得广播的ip地址,比如本机是192.168.0.1,这个函数得到192.168.0.255
function TFunc.GetRadiateIP:String;
var i,j,iHead:Integer;
sHead,s:String;
ai:array [1..3] of integer;
LocalIPAdd:string;
begin
Result:='192.168.255.255';
LocalIPAdd:=GetLocalIP; //GetLocalIP为本机IP,这样Powersock1.LocalIP
j:=1;
//取出.的位置
for i:=0 to Length(LocalIPAdd) do
begin
if LocalIPAdd[i]='.' then
begin ai[j]:=i; Inc(j); end;
if j>3 then break;
end;
//shead为ip第一段
sHead:=Copy(LocalIpAdd,1,ai[1]-1);
iHead:=StrToInt(sHead);
if iHead<128 then //A类网
Result:=sHead+'.255.255.255'//a类网的广播ip
else
begin
if iHead<192 then //B类网
begin
s:=Copy(LocalIPAdd,1,ai[2]-1);
Result:=s+'.255.255';//b类网的广播ip
end
else //C类网
begin
s:=Copy(LocalIPAdd,1,ai[3]-1);
Result:=s+'.255';//c类网的广播ip
end;
end;
end;
角落的青苔 2003-05-21
  • 打赏
  • 举报
回复
[灌水]远程启动函数
procedure TFunc.PowerMachine(aMac: String;NMUDP1:TNMUDP);
//aMac为受控方网卡地址
var Str:Array[1..102] of char;
i:Integer;
function StrtoHex(S:String):Byte;
begin
Result := 0;
Case S[2] of
'0': Result := 0;
'1': Result := 1;
'2': Result := 2;
'3': Result := 3;
'4': Result := 4;
'5': Result := 5;
'6': Result := 6;
'7': Result := 7;
'8': Result := 8;
'9': Result := 9;
'A': Result := 10;
'B': Result := 11;
'C': Result := 12;
'D': Result := 13;
'E': Result := 14;
'F': Result := 15;
end;
Case S[1] of
'0': Result := Result;
'1': Result := Result + 16*1;
'2': Result := Result + 16*2;
'3': Result := Result + 16*3;
'4': Result := Result + 16*4;
'5': Result := Result + 16*5;
'6': Result := Result + 16*6;
'7': Result := Result + 16*7;
'8': Result := Result + 16*8;
'9': Result := Result + 16*9;
'A': Result := Result + 16*10;
'B': Result := Result + 16*11;
'C': Result := Result + 16*12;
'D': Result := Result + 16*13;
'E': Result := Result + 16*14;
'F': Result := Result + 16*15;
end;
end;
begin
for i := 1 to 6 do Str[i] := #255;
i := 7;
while i < 103 do
begin
Str[i] := chr(StrToHex(Copy(aMac,1,2)));
Str[i+1] := chr(StrToHex(Copy(aMac,3,2)));
Str[i+2] := chr(StrToHex(Copy(aMac,5,2)));
Str[i+3] := chr(StrToHex(Copy(aMac,7,2)));
Str[i+4] := chr(StrToHex(Copy(aMac,9,2)));
Str[i+5] := chr(StrToHex(Copy(aMac,11,2)));
inc(i,6);
end;
NMUDP1.LocalPort := 6666;
NMUDP1.RemotePort := 6666;
NMUDP1.RemoteHost:=GetRadiateIP;//广播地址,GetRadiateIP函数见下
NMUDP1.ReportLevel := 1;
NMUDP1.SendBuffer(Str,102);
end;

end.
scmox 2003-05-21
  • 打赏
  • 举报
回复
关机太好办了,呵呵,如果你想远程控制的电脑主板和网卡支持网络唤醒,你可以发送连续的特殊格式的数据包,很久以前看到的,建议你去intel和AMD看一下,他们都有这方面的类库!
youou 2003-05-21
  • 打赏
  • 举报
回复
我是要用DELPHI来写程序实现的...

还要实现其它一些功能的...

请问需要了解哪方面的内容?
蓝色光芒 2003-05-21
  • 打赏
  • 举报
回复
写个服务程序给它并运行,然后开一个端口,然后你对这个端口发控制命令就是了三。
或者你给它拷贝一个ShutDown,然后给他开Telnet,然后运行ShutDown,呵呵,关了。
zjf27 2003-05-21
  • 打赏
  • 举报
回复
远程控制用pcanywhere,Radmin可以进行关机,至于开机,以前在哪看到过,也不太清楚

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧