远程控制的实现(200分)

  • 主题发起人 主题发起人 fastrunner
  • 开始时间 开始时间
F

fastrunner

Unregistered / Unconfirmed
GUEST, unregistred user!
有象PCANYWHERE之类的程序的原代码么?
里面的权限的控制怎么实现?
 
用鼠标点击(包括单击、双击、右击)image控件(客户机的屏幕用image控件显示)
的某一个图标,在客户机上相应的地方也有相应的操作(Image控件上的图标的坐标
和客户机屏幕上的相应的图标一一对应)。
 
客户端:
procedure TForm1.Image1DblClick(Sender: TObject);
begin
clientsocket1.Socket.SendText(inttostr(cx)+'ssdouble'+inttostr(cy));
end;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
cx:=x;
cy:=y;
if shift=[ssleft] then
begin
clientsocket1.Socket.SendText(inttostr(x)+'ssleft'+inttostr(y));
end;
if shift=[ssright] then
begin
clientsocket1.Socket.SendText(inttostr(x)+'ssright'+inttostr(y));
end;
end;
cx,cy是两个自定义变量.

服务器端:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
s:string;
s2:pchar;
sx,sy:integer
begin
s:=socket.ReceiveText;
s2:=pchar(s);
if strpos(s2,'ssdouble')<>nil then
begin
sx:=strtoint(copy(s,1,strpos(s2,'ssdouble')-s2));
sy:=strtoint(copy(s,(strpos(s2,'ssdouble')-s2)+9,length(s)-(strpos(s2,'ssdouble')-s2)-8));
setcursorpos(sx,sy);
mouse_event(MOUSEEVENTF_LEFTDOWN, sx, sy, 0, 0 );
mouse_event(MOUSEEVENTF_LEFTUP, sx, sy, 0, 0 );
mouse_event(MOUSEEVENTF_LEFTDOWN, sx, sy, 0, 0 );
mouse_event(MOUSEEVENTF_LEFTUP, sx, sy, 0, 0 );
end;
if strpos(s2,'ssleft')<>nil then
begin
sx:=strtoint(copy(s,1,strpos(s2,'ssleft')-s2));
sy:=strtoint(copy(s,(strpos(s2,'ssleft')-s2)+7,length(s)-(strpos(s2,'ssdouble')-s2)-6));
setcursorpos(sx,sy);
mouse_event(MOUSEEVENTF_LEFTDOWN, sx, sy, 0, 0 );
mouse_event(MOUSEEVENTF_LEFTUP, sx, sy, 0, 0 );
end;
if strpos(s2,'ssright')<>nil then
begin
sx:=strtoint(copy(s,1,strpos(s2,'ssright')-s2));
sy:=strtoint(copy(s,(strpos(s2,'ssright')-s2)+8,length(s)-(strpos(s2,'ssright')-s2)-7));
setcursorpos(sx,sy);
mouse_event(MOUSEEVENTF_RIGHTDOWN, sx, sy, 0, 0 );
mouse_event(MOUSEEVENTF_RIGHTUP, sx, sy, 0, 0 );
end;
end;
 
接受答案了.
 
后退
顶部