jezzzzy Posted February 19, 2009 Share Posted February 19, 2009 (edited) I run GUISetState(@SW_HIDE,$GUIMain) when the close icon is clicked to imitate a "minimized to tray" behavior. However, this minimized GUI steals focus for each update. These updates happen every 30s. You can imagine how aggravating it is to have your active window lose focus every 30 seconds. When this window is "maximized" again with GUISetState(), it doesn't steal the focus. My update function is lengthy and I can't seem to narrow down what is causing the hidden window to grab focus. I don't use any weird functions in my update function: _inetget stuff and string manipulation is really all. There are some GUISetState(@SW_DISABLE) and GUISetState(@SW_ENABLE) also. Edit: spelling Edited February 19, 2009 by jezzzzy Link to comment Share on other sites More sharing options...
martin Posted February 19, 2009 Share Posted February 19, 2009 I run GUISetState(@SW_HIDE,$GUIMain) when the close icon is clicked to imitate a "minimized to tray" behavior. However, this minimized GUI steals focus for each update. These updates happen every 30s. You can imagine how aggravating it is to have your active window lose focus every 30 seconds. When this window is "maximized" again with GUISetState(), it doesn't steal the focus. My update function is lengthy and I can't seem to narrow down what is causing the hidden window to grab focus. I don't use any weird functions in my update function: _inetget stuff and string manipulation is really all. There are some GUISetState(@SW_DISABLE) and GUISetState(@SW_ENABLE) also.Edit: spellingI think you'll need to post some code which reproduces the problem to make progress with that one. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
jezzzzy Posted February 19, 2009 Author Share Posted February 19, 2009 Ok. I've narrowed down the problem to the following functions: Func _LockAndWait() GUISetState(@SW_DISABLE) GUISetCursor(15, 1) EndFunc ;==>_LockAndWait Func _ResetLockWait() GUISetState(@SW_ENABLE) GUISetCursor(2, 1) EndFunc ;==>_ResetLockWait I believe these are a variation of GaryFrost's functions. If I comment out the function call for these, the gui doesn't steal focus. I have narrowed it down to the GUISetState(@SW_ENABLE) and GUISetState(@SW_DISABLE). I'm guessing this is just a by-product of enabling and disabling the GUI. Is there a better way to disable the GUI without it getting focused? Link to comment Share on other sites More sharing options...
martin Posted February 19, 2009 Share Posted February 19, 2009 Ok. I've narrowed down the problem to the following functions: Func _LockAndWait() GUISetState(@SW_DISABLE) GUISetCursor(15, 1) EndFunc;==>_LockAndWait Func _ResetLockWait() GUISetState(@SW_ENABLE) GUISetCursor(2, 1) EndFunc;==>_ResetLockWait I believe these are a variation of GaryFrost's functions. If I comment out the function call for these, the gui doesn't steal focus. I have narrowed it down to the GUISetState(@SW_ENABLE) and GUISetState(@SW_DISABLE). I'm guessing this is just a by-product of enabling and disabling the GUI. Is there a better way to disable the GUI without it getting focused? Do you repeatedly call those functions when you have the problem? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
jezzzzy Posted February 20, 2009 Author Share Posted February 20, 2009 They get called once each update cycle (generally every 30s). Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 20, 2009 Share Posted February 20, 2009 They get called once each update cycle (generally every 30s).Why are you enabling and disabling a hidden window? That seems very unnecessary to me .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
martin Posted February 20, 2009 Share Posted February 20, 2009 They get called once each update cycle (generally every 30s). I think you just need to remember the set state, or read the state. Global $LockState = 0 Func _LockAndWait() If $LockState = @SW_DISABLE then return GUISetState(@SW_DISABLE) GUISetCursor(15, 1) $LockState = @SW_DISABLE EndFunc;==>_LockAndWait Func _ResetLockWait() If $LockState = @SW_ENABLE then return GUISetState(@SW_ENABLE) GUISetCursor(2, 1) $LockState = @SW_ENABLE EndFunc;==>_ResetLockWait Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
jezzzzy Posted February 23, 2009 Author Share Posted February 23, 2009 Why are you enabling and disabling a hidden window? That seems very unnecessary to meDisabling it in the off chance that the user unhides the window with the task tray icon during the update. I may just disable the "unhide" option during the update. That seems to be a good workaround. Thanks for helping me noodle the problem. 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