Вверх ↑
Ответов: 181
Рейтинг: 14
#1: 2022-03-11 12:20:50 ЛС | профиль | цитата
andrestudio, Большое Спасибо, работает.
Смена имени пользователя не обязательна, достаточно нажатия на "Сменить пользователя".
Add(MainForm,2953706,147,84)
{
Width=344
Height=321
}
Add(InlineCode,2206947,70,105)
{
EventPoints=#5:onMsg|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|29:uses kol,Windows,Share,Debug;|0:|5:const|88: // The WM_WTSSESSION_CHANGE message notifies applications of changes in session state.|30: WM_WTSSESSION_CHANGE = $2B1;|19: // wParam values:|26: WTS_CONSOLE_CONNECT = 1;|29: WTS_CONSOLE_DISCONNECT = 2;|25: WTS_REMOTE_CONNECT = 3;|28: WTS_REMOTE_DISCONNECT = 4;|24: WTS_SESSION_LOGON = 5;|25: WTS_SESSION_LOGOFF = 6;|23: WTS_SESSION_LOCK = 7;|25: WTS_SESSION_UNLOCK = 8;|33: WTS_SESSION_REMOTE_CONTROL = 9;|79: // Only session notifications involving the session attached to by the window|63: // identified by the hWnd parameter value are to be received.|30: NOTIFY_FOR_THIS_SESSION = 0;|50: // All session notifications are to be received.|32: NOTIFY_FOR_ALL_SESSIONS = 1; |0:|4:type|28: THiAsmClass = class(TDebug)|10: private|25: fOldMsg: TOnMessage;|67: function onMessage(var Msg: TMsg; var Rslt: Integer): Boolean;|9: public|23: onMsg: THI_Event; |24: constructor Create;|20: procedure Init;|5: end;|1: |81: function WTSRegisterSessionNotification(Handle: THandle; Flags: DWORD): boolean;|38: stdcall; external 'Wtsapi32.dll';|0:|14:implementation|0:|74:function THiAsmClass.onMessage(var Msg: TMsg; var Rslt: Integer): Boolean;|3:var|20: strReason: string;|5:begin|21: case Msg.Message of|25: WM_WTSSESSION_CHANGE:|11: begin|26: case Msg.wParam of|66: WTS_CONSOLE_CONNECT: strReason := 'WTS_CONSOLE_CONNECT';|72: WTS_CONSOLE_DISCONNECT: strReason := 'WTS_CONSOLE_DISCONNECT';|64: WTS_REMOTE_CONNECT: strReason := 'WTS_REMOTE_CONNECT';|70: WTS_REMOTE_DISCONNECT: strReason := 'WTS_REMOTE_DISCONNECT';|62: WTS_SESSION_LOGON: strReason := 'WTS_SESSION_LOGON';|64: WTS_SESSION_LOGOFF: strReason := 'WTS_SESSION_LOGOFF';|60: WTS_SESSION_LOCK: strReason := 'WTS_SESSION_LOCK';|64: WTS_SESSION_UNLOCK: strReason := 'WTS_SESSION_UNLOCK';|80: WTS_SESSION_REMOTE_CONTROL: strReason := 'WTS_SESSION_REMOTE_CONTROL';|13: else|38: strReason := 'WTS_Unknown';|12: end;|39: _hi_onEvent(onMsg,strReason); |10: end;|6: end;|44: Result := _hi_OnMessage(fOldMsg,Msg,Rslt);|4:end;|0:|31:constructor THiAsmClass.Create;|5:begin|12: inherited;|16: InitAdd(Init);|4:end;|0:|27:procedure THiAsmClass.Init;|5:begin|30: fOldMsg := Applet.OnMessage;|32: Applet.OnMessage := onMessage;|72: WTSRegisterSessionNotification(Applet.Handle,NOTIFY_FOR_THIS_SESSION);|4:end;|0:|4:end.|
link(onMsg,2953706:doClose,[])
}

карма: 0

0
Редактировалось 1 раз(а), последний 2022-03-11 12:25:20