Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows shutdown
#1
Hello,

i would like to intercept windows shutdown/reboot process, to make some costum action before, and then shutdown/reboot via QM.

I think about 2 scenarii, but i'd like to know if it is possible in QM.

If not directly, what is the code for launching several macros/functions in sequence, each one waiting the precedent one to
finally exit windows at the end of all actions done?

1. exemple, i could create a shortcut to a macro on desktop, containing all the actions, and then quit windows

Macro "ActionsOnShutdown"

macro1
;; wait til finished then
macro2
;; wait til finished
etc
;;
shutdown/reboot windows

But I MUST be sure each macro will wait for the one before to be finished before acting..... (thought about thread stuff, but can't get the whole picture)

2. or better is possible, adaptation in QM of catch WM_SHUTDOWN/WM_QUERYENDSESSION like this one would great,
like this VB code

http://community.bartdesmet.net/blogs/b ... 2300_.aspx

3. Or better way specific to QM??

Regards



Thanks.
#2
This should work. Not tested. Let it be running all the time.
Function WindowsShutdownTrigger
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("" &WindowsShutdownTrigger 0 0 128)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2030400 "*" "" "" ""

ret
;messages
sel message
,case WM_COMMAND ret 1
,case WM_QUERYENDSESSION
,
,mes "WM_QUERYENDSESSION" "WindowsShutdownTrigger" ;;for testing; delete then
,
,opt waitmsg 1
,wait 60 H mac("Macro1"); err
,wait 60 H mac("Macro2"); err
,
#3
I found this routine very useful. I am wondering what is the best method to inhibit shutdown, under certain conditions, at this point. Many thanks for any advice, in advance.
#4
Returning 0 on WM_QUERYENDSESSION should do it, but I did not test. Read more in WM_QUERYENDSESSION reference in MSDN.

ret DT_Ret(hDlg 0)
#5
Thank you. I tested it, it works perfectly. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)