Hi,
I tried this script and modified a little bit to include to run my batch script before logging off or shutting down my win7 pc. However, my batch script didn't run. Any idea? Appreciate your help. Tnx
I tried this script and modified a little bit to include to run my batch script before logging off or shutting down my win7 pc. However, my batch script didn't run. Any idea? Appreciate your help. Tnx
$WM_QUERYENDSESSION=0x0011 GUICreate"ShutDownNotificationGui" GUIRegisterMsg($WM_QUERYENDSESSION, "_ShutdownInitiated") GUISetSTate(@SW_HIDE) While 1 Sleep(10) WEnd Func _ShutdownInitiated($hWndGUI, $MsgID, $WParam, $LParam) If $WParam = 0 Then RunWait(@COMSPEC & " /c c:\Mybatch.bat") Msgbox(0,"","Shutting down") EndIf If BitAnd($WParam,0x80000000) = 0x80000000 Then RunWait(@COMSPEC & " /c c:\Mybatch.bat") Msgbox(0,"","logging off") Return True EndIf EndFunc