Maffe811 Posted December 14, 2013 Posted December 14, 2013 After a quick search, this showed up:'?do=embed' frameborder='0' data-embedContent>> and one of the comments suggested this: expandcollapse popupGUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown") GUICreate("PreventShutdownGUI") GUISetSTate(@SW_HIDE) ; set highest notification level If Not _SetProcessShutdownParameters(0xFFF) Then ; MSDN says maximum is 0x4FF, but it worked for me If Not _SetProcessShutdownParameters(0x4FF) Then ; MSDN says this is reserved for System, but worked for me _SetProcessShutdownParameters(0x3FF) ; highest not reserved number, if everything else does not work EndIf EndIf Global $b_ShutdownInitiated = False While 1 If $b_ShutdownInitiated = True then $b_ShutdownInitiated = False MsgBox(48 + 8192 + 262144, "Installer", "Ending your user session has been disabled to allow the installation to complete." _ & @CRLF & @CRLF & "You will be able to shutdown/reboot/logoff once the installation process has completed." , 8) EndIf sleep(10) WEnd Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam) $b_ShutdownInitiated = True ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return False EndFunc Func _SetProcessShutdownParameters($dwLevel, $dwFlags=0) ; <a href='http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx</a> ; Prog@ndy Local $aResult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwLevel, "dword", $dwFlags) If @error Then Return SetError(1,0,0) Return $aResult[0] EndFunc And not 100% sure what everything does, but i can't even test it because this comes up: WARNING: $WM_QUERYENDSESSION: possibly used before declaration. GUIRegisterMsg($WM_QUERYENDSESSION, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ and i don't know what i need to do to fix it. Any suggestions? [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]
Moderators Melba23 Posted December 14, 2013 Moderators Posted December 14, 2013 Maffe811,The WM_ suggests it is a "Windows Message" - and that is indeed where you find it. Just include WindowsConstants.au3. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Maffe811 Posted December 14, 2013 Author Posted December 14, 2013 Aaah... That makes sence! Thanks! [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]
Maffe811 Posted December 14, 2013 Author Posted December 14, 2013 Can anyone explain me how to get, lets say a message box to pop up when the computer is shuttingdown/logging off ? Cause i've tried making it work, but nothing makes it work. expandcollapse popupGUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown") GUICreate("PreventShutdownGUI") GUISetSTate(@SW_HIDE) ; set highest notification level If Not _SetProcessShutdownParameters(0xFFF) Then ; MSDN says maximum is 0x4FF, but it worked for me If Not _SetProcessShutdownParameters(0x4FF) Then ; MSDN says this is reserved for System, but worked for me _SetProcessShutdownParameters(0x3FF) ; highest not reserved number, if everything else does not work EndIf EndIf Global $b_ShutdownInitiated = False While 1 If $b_ShutdownInitiated = True then $b_ShutdownInitiated = False MsgBox(48 + 8192 + 262144, "Installer", "Ending your user session has been disabled to allow the installation to complete." _ & @CRLF & @CRLF & "You will be able to shutdown/reboot/logoff once the installation process has completed." , 8) EndIf sleep(10) WEnd Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam) $b_ShutdownInitiated = True ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return False EndFunc Func _SetProcessShutdownParameters($dwLevel, $dwFlags=0) ; <a href='http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx</a> ; Prog@ndy Local $aResult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwLevel, "dword", $dwFlags) If @error Then Return SetError(1,0,0) Return $aResult[0] EndFunc [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]
kylomas Posted December 15, 2013 Posted December 15, 2013 Maffe811, See the example for function _WinAPI_SetProcessShutdownParameters. This is in the UDF _WinAPIEx.au3, just search the forum for it. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Maffe811 Posted December 15, 2013 Author Posted December 15, 2013 Thank you! Exactly what i needed! [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now