深圳全飞鸿

标题: terminal程序TCP的execute分析 [打印本页]

作者: zhgc    时间: 2019-6-6 21:40
标题: terminal程序TCP的execute分析
  1. procedure TUDPMainForm.mytcpExecute(AThread: TIdPeerThread);
  2. var
  3.   content:string;
  4.   nLen: Integer;
  5.   gg:string;
  6. begin
  7.   //-----------------记录下SMO的线程-----------------
  8.   // SM O_thread.threadID:=Athread;
  9.   // SMO_thread.ip:='OK';
  10.   //-------------------------------------------------
  11.   try
  12.     if not AThread.Terminated and AThread.Connection.Connected then
  13.     begin
  14.           //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
  15.             if athread.Connection.Tag=8 then   // 8 is for remote control ...
  16.             begin
  17.                athread.Connection.readbuffer(FCmdBuf, SizeOf(TCtlCmd));
  18.                if true then
  19.                begin
  20.                   if true then
  21.                   begin
  22.                     FCmdRec := 0;
  23.                     try
  24.                       Move(FCmdBuf[0], FCmd, SizeOf(TCtlCmd));
  25.                       if FCmd.Cmd in [1..7] then
  26.                       begin
  27.                         FPoint := Point(FCmd.X, FCmd.Y);
  28.                         SetCursorPos(FCmd.X, FCmd.Y);
  29.                         SetCapture(WindowFromPoint(FPoint));
  30.                       end;
  31.                       case FCmd.Cmd of
  32.                         1: ;//mouse move
  33.                         2: mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
  34.                         3: mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  35.                         4: mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
  36.                         5: mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
  37.                         6:
  38.                             begin
  39.                               mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
  40.                               mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  41.                             end;
  42.                         7:
  43.                             begin
  44.                               mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
  45.                               mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
  46.                             end;
  47.                         8: keybd_event(Byte(FCmd.X), 0, 0, 0);
  48.                         9: keybd_event(Byte(FCmd.X), 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
  49.                       end;
  50.                     except
  51.                     end;
  52.                    end;
  53.                  end;
  54.                  exit;
  55.             end;

  56.           //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
  57.            content:=athread.Connection.ReadLn(LF,10);
  58.            if trim(content)='$REMOTE then
  59.            begin
  60.              athread.Connection.Tag:=8;
  61.              syant:=TScreenSpy.Create(athread.Connection);
  62.              syant.Resume;
  63.              exit;
  64.            end;
  65.            IF (TRIM(CONTENT)='@SYANT@') OR (TRIM(CONTENT)='') THEN
  66.            BEGIN
  67.               application.ProcessMessages;
  68.               exit;
  69.            END;
  70.            UDPMainForm.Writelog('=='+content);
  71.            TCP_message:=content;
  72.            show_info('(TCP)有收到消息: '+content);
  73.            athread.Synchronize(TCP_get_core);
  74.     end;
  75.   except
  76.   end;
  77. end;
复制代码





欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2