delphi监控windows远程控制消息

来源:互联网 发布:linux运维工程师工资 编辑:程序博客网 时间:2024/05/16 11:08
 procedure TMainFrm.AppMessage(var Msg: TMSG; var HAndled: Boolean);
var
  strReason: string;
begin
  Handled := False;
  case Msg.Message  of
    WM_WTSSESSION_CHANGE :
    begin
      case Msg.wParam of
       WTS_CONSOLE_CONNECT:
           strReason := 'WTS_CONSOLE_CONNECT';
       WTS_CONSOLE_DISCONNECT:
           strReason := 'WTS_CONSOLE_DISCONNECT';
       WTS_REMOTE_CONNECT:
           strReason := 'WTS_REMOTE_CONNECT';
       WTS_REMOTE_DISCONNECT:
           strReason := 'WTS_REMOTE_DISCONNECT';
       WTS_SESSION_LOGON:
           strReason := 'WTS_SESSION_LOGON';
       WTS_SESSION_LOGOFF:
           strReason := 'WTS_SESSION_LOGOFF';
       WTS_SESSION_LOCK:
           strReason := 'WTS_SESSION_LOCK';             // 用户锁屏
       WTS_SESSION_UNLOCK:
           strReason := 'WTS_SESSION_UNLOCK';           // 用户解锁
       WTS_SESSION_REMOTE_CONTROL:
       begin
         strReason := 'WTS_SESSION_REMOTE_CONTROL';     // 远程控制
//          GetSystemMetrics(SM_REMOTECONTROL);
       end;
      else
        strReason := 'WTS_Unknown';
      end;
    end;
  end;


end;
原创粉丝点击