|
用delphi实现冰河的远程屏幕操作功能(6) SetFocus; CreateSleepThread; // SleepDone will be called when it is finished end;
if MsgNum = MSG_COMP_MODE then begin Move(Data[1], x, sizeof(integer)); CompMode := TCompressionLevel(x); SendMsg(MSG_COMP_MODE, '', Socket); end;
if MsgNum = MSG_PRIORITY_MODE then begin Move(Data[1], x, sizeof(integer)); SetThreadPriority(GetCurrentThread, x); SendMsg(MSG_PRIORITY_MODE, '', Socket); end;
if MsgNum = MSG_PROCESS_LIST then begin SendMsg(MSG_PROCESS_LIST, Get_Process_List, Socket); end;
if MsgNum = MSG_CLOSE_WIN then begin CloseWindow(Data); end;
if MsgNum = MSG_KILL_WIN then begin KillWindow(Data); end;
if MsgNum = MSG_DRIVE_LIST then begin SendMsg(MSG_DRIVE_LIST, Get_Drive_List, Socket); end;
if MsgNum = MSG_DIRECTORY then begin SendMsg(MSG_DIRECTORY, GetDirectory(Data), Socket); end;
if MsgNum = MSG_FILE then begin SendMsg(MSG_FILE, GetFile(Data), Socket); end;
if MsgNum = MSG_REMOTE_LAUNCH then begin SendMsg(MSG_STAT_MSG, 'Launching File: ' + Data, Socket); rc := ShellExecute(Handle, 'open', PChar(Data), nil, nil, SW_SHOWNORMAL); if rc <= 32 then begin Data := Format('ShellExecute Error #%d Launching %s', [rc, Data]); SendMsg(MSG_REMOTE_LAUNCH, Data, Socket); end else begin SendMsg(MSG_REMOTE_LAUNCH, Data, Socket); end; end; end;
function EnumWinProc(hw: THandle; lp: LParam): boolean; stdcall; var sl : TStringList; buf : array[0..MAX_PATH] of char; s, iv : string; begin sl := TStringList(lp); GetWindowText(hw, buf, sizeof(buf)); if buf<>'' then begin if IsWindowVisible(hw) then iv := '' else iv := '(Invisible)'; s := Format('%8.8x - %-32s %s', [hw, buf, iv]); sl.AddObject(s, TObject(hw)); end; Result := True; end;
function TServerForm.Get_Process_List: string; var sl : TStringList; begin sl := TStringList.Create; EnumWindows(@EnumWinProc, integer(sl));
|