Simpel Posted March 25, 2017 Share Posted March 25, 2017 (edited) Hi, I wrote a script using 2 GUIs. At some point I AdlibRegister a function to always WinActivate GUI1 if GUI2 is activated. Most of the time it works perfect. But I have the feeling that nearly always if I stop executing the uncompiled au3 with Strg+Break and restart the script then the AdlibRegister returns 1 but will not run. If I exit the script with Exit everything is fine. Did I noticed it right? Is there a AdlibRegister issue if script is aborted? Is there a possibility to fix this? Regards, Conrad P.S. The script is about 1000 lines, so I think it wouldn't be helpful posting it. And I have no idea how to make it very small but prove the issue. Edited March 25, 2017 by Simpel [Solved] SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 25, 2017 Developers Share Posted March 25, 2017 35 minutes ago, Simpel said: Strg+Break You mean in SciTE? This will kill the process so don't expect any clean termination of the script. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
InunoTaishou Posted March 25, 2017 Share Posted March 25, 2017 (edited) #include <GUIConstants.au3> #include <WinAPI.au3> #include <WinAPISys.au3> Global Const $WA_ACTIVE = 1 Global Const $WA_CLICKACTIVE = 2 Global $hMain = GUICreate("Window 1") Global $hSecond = GUICreate("Window 2") GUIRegisterMsg($WM_ACTIVATE, WM_ACTIVATE) GUISetState(@SW_SHOW, $hMain) GUISetState(@SW_SHOW, $hSecond) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 EndSwitch WEnd Func WM_ACTIVATE($hWnd, $iMsg, $wParam, $lParam) Switch (_WinAPI_LoWord($wParam)) Case $WA_ACTIVE, $WA_CLICKACTIVE Switch ($hWnd) Case $hSecond ConsoleWrite("[" & @MIN & ":" & @SEC & ":" & @MSEC & "] Second window set to active, changing to main" & @LF) Return _WinAPI_SetActiveWindow($hMain) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_ACTIVATE Give that a go instead of using AdLibRegister. Just use GUIRegisterMsg($WM_ACTIVATE, "") to turn off the activate function Edited March 26, 2017 by InunoTaishou Changed $WA_INACTIVE to $WA_CLICKACTIVE, had the proper value, just the wrong name Simpel 1 Link to comment Share on other sites More sharing options...
Simpel Posted March 25, 2017 Author Share Posted March 25, 2017 Hi @InunoTaishou, your example works perfect. I have to prove whether I can put it into my script without greater problems. I'll give it a try. Thank you and regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Simpel Posted March 25, 2017 Author Share Posted March 25, 2017 There was no problem to implement this. Thanks again. SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
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