Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switch User Trigger
#2
Function dialog_switch_user_trigger
Code:
Copy      Help
;A hidden dialog that receives Windows user session notifications.


if(_winver<0x501) ret ;;not on Windows 2000

str dd=
;BEGIN DIALOG
;0 "" 0x80C800C8 0x0 0 0 224 136 "Dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2040200 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0 0 128)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,WTSRegisterSessionNotification hDlg NOTIFY_FOR_THIS_SESSION
,
,case WM_DESTROY
,WTSUnRegisterSessionNotification hDlg
,
,case WM_WTSSESSION_CHANGE
,sel wParam
,,case WTS_CONSOLE_CONNECT
,,out "My session switched on"
,,case WTS_CONSOLE_DISCONNECT
,,out "My session switched off"
,
,case WM_COMMAND ret 1

Also try Windows Task Scheduler triggers 'On [dis]connection to user session'.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)