CodeMaster Rapture Posted November 22, 2006 Share Posted November 22, 2006 Greetings all, I'm working on a project and trying to find a better way to enable/disable hotkeys. Here's what I have so far: While 1 If (WinActive($szTitle)) Then HotKeySet("{ENTER}", "_SendData") Else HotKeySet("{ENTER}") EndIf Switch (GUIGetMsg()) Case ($GUI_EVENT_CLOSE) _Exit() EndSwitch ;Snipped irrelevant code WEnd oÝ÷ ÙhbëaÌ(®Kw¶§+b±¬²×¨|#Ô¦ë)yȬw&©¦+-g¬z{"¶+Þ#f¶¼¢h²¯zßjÉ)¢X¬yÊ'vƬ¦,¹^¥êå¢R¢l ܲÚ,yè!Ê.×+y«^ÚæÊ'z÷§¶Á ED51qhrëÑ ED52è±áhrëÛazwh¶¢ÙÊËn}ùbë(jëh×6 While 1 Switch (GUIGetMsg()) Case ($GUI_EVENT_CLOSE) _Exit() Case ($GUI_EVENT_GAINFOCUS) HotkeySet("{ENTER}","_SomeFunc") Case ($GUI_EVENT_LOSEFOCUS) HotKeySet("{ENTER}") EndSwitch WEnd The closest thing I could find on MSDN that would suit my needs is EVENT_OBJECT_FOCUS (which is triggered when hwndObject is given keyboard focus). I just dunno how to implement it in Au3. I've got some other things I'd like to set event on (i.e. GUI control's limit being reached), and shave off some more time if I can. I'm trying to stay away from DLL calls cuz they can be slow. Any suggestions? Thanx -CMR Link to comment Share on other sites More sharing options...
lod3n Posted November 22, 2006 Share Posted November 22, 2006 Why not just assign a button $BS_DEFPUSHBUTTON style, and then attach your _SomeFunc to that button. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
CodeMaster Rapture Posted November 23, 2006 Author Share Posted November 23, 2006 Well, OnEvent will work fine for the buttoon, but I don't want my hotkeys to take over while the window isn't active. -CMR 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