Flok3r Posted April 24, 2011 Share Posted April 24, 2011 Hi you kind supporters, My tool has a structure like that (in script steps): -GUI is built -Window is hidden with GUISetState(@SW_HIDE) -typicall while 1 loop checking for GUIGetMsg() AND checking: If _IsPressed("01",$dll) And _IsPressed("02",$dll) Then "make GUI visible" My actual problem refers to ispressed (which has to be used in order to manage simultanious keystrokes, i assume?!): If i enter keys like TAB or arrow keys (which are not triggered in my script) while the tool is hidden, the current window, e.g. FireFox, loses its focus. How can i avoid that but still trigger an action by simultanious key-/mousestrokes? Since im a newbe, there are perhaps better solutions than _IsPressed and perhaps there is a better way than including this check as If block in a while loop??! Thanks for any advice / suggestion / help, Flok3r Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 24, 2011 Moderators Share Posted April 24, 2011 Flok3r, This works fine for me: #include <GUIConstantsEx.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") $hGUI = GUICreate("Test", 500, 500) GUISetState(@SW_HIDE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DllClose($dll) Exit Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE) EndSwitch If _IsPressed("01", $dll) And _IsPressed("09", $dll) Then ; Left mouse and TAB GUISetState(@SW_SHOW) GUISetState(@SW_RESTORE) EndIf WEnd I do not really understand: If i enter keys like TAB or arrow keys (which are not triggered in my script) while the tool is hidden, the current window, e.g. FireFox, loses its focusFor me the keys act in the active GUI which remains active. 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 Link to comment Share on other sites More sharing options...
Flok3r Posted April 24, 2011 Author Share Posted April 24, 2011 Thanks for your fast help, im sorry that my question wasnt clear, but now (i just modified my script, but cant point out the respecting part) i cant even reproduce that "behaviour", i.d. all windows with editable controls remain active/focused while pressing tab or "right" for example. If someone troubles like i did, here 2 reasons, which could have been my problem: -The while loop contains too many of those checks, wich look for keys pressed simultaniously (slow PC) -A antivirus software might check the script or a part of it (as avira did with mine) and suspend it while examining it or so, which leads to the focus loss I am sure, that behaviour will reappear after further modifications, because i troubled the past weeks with it (must have been this function), but considered it as a bug (perhaps it is one). I will post a new question if i manage to figure out, what triggers that focus loss. 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