geekycoder Posted November 11, 2009 Share Posted November 11, 2009 Does autoit support Event handling for Window's focus and lost focus ? How can autoit register listener for Window's focus and lost focus ? Or do I need to implement it myself. GUIGetMsg() support only certain window events but not focus and lost focus. thk Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 11, 2009 Share Posted November 11, 2009 You want GUIRegisterMsg(), see helpfile for syntax and examples. .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...
geekycoder Posted November 11, 2009 Author Share Posted November 11, 2009 You want GUIRegisterMsg(), see helpfile for syntax and examples.Hi, thank for reply.GUIRegisterMsg seems to work only with windows create with GUICreate (as I find from most examples) ?If I have existing app like Notepad, how do I use GUIRegisterMsg to listen for window focus event of Notepad ? Link to comment Share on other sites More sharing options...
CodyBarrett Posted November 11, 2009 Share Posted November 11, 2009 #Include <WinAPI.au3> _WinAPI_RegisterWindowMessage($sMessage) is that what you are looking for? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
wraithdu Posted November 11, 2009 Share Posted November 11, 2009 You want this example of Shell Hooking. Link to comment Share on other sites More sharing options...
Yashied Posted November 11, 2009 Share Posted November 11, 2009 #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm $hForm = GUICreate('') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), '_ShellHookProc') _WinAPI_RegisterShellHookWindow($hForm) While 1 Sleep(100) WEnd Func _ShellHookProc($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $wParam Case $HSHELL_WINDOWACTIVATED ConsoleWrite('Activated: ' & WinGetHandle($lParam) & @CR) EndSwitch EndSwitch EndFunc ;==>_ShellHookProc Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($hForm) EndFunc ;==>OnAutoItExitWinAPIEx.au3 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
geekycoder Posted November 12, 2009 Author Share Posted November 12, 2009 #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm $hForm = GUICreate('') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), '_ShellHookProc') _WinAPI_RegisterShellHookWindow($hForm) While 1 Sleep(100) WEnd Func _ShellHookProc($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $wParam Case $HSHELL_WINDOWACTIVATED ConsoleWrite('Activated: ' & WinGetHandle($lParam) & @CR) EndSwitch EndSwitch EndFunc ;==>_ShellHookProc Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($hForm) EndFunc ;==>OnAutoItExit WinAPIEx.au3 Yashied, thank for the solution. It is very useful. thank all for the help. Link to comment Share on other sites More sharing options...
VAN0 Posted March 3, 2014 Share Posted March 3, 2014 #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm $hForm = GUICreate('') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), '_ShellHookProc') _WinAPI_RegisterShellHookWindow($hForm) While 1 Sleep(100) WEnd Func _ShellHookProc($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $wParam Case $HSHELL_WINDOWACTIVATED ConsoleWrite('Activated: ' & WinGetHandle($lParam) & @CR) EndSwitch EndSwitch EndFunc ;==>_ShellHookProc Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($hForm) EndFunc ;==>OnAutoItExitWinAPIEx.au3 Hello. Can someone please help make this work with AU 3.3.10.2 on W8 x64? Nothing happens when I run the script and change focus on different windows. Thank you Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 3, 2014 Moderators Share Posted March 3, 2014 Van0, there is a reason we don't resurrect 5 year old posts. As you have learned, what worked in 2009 is likely not valid in 2014. You would be better off creating a new topic to ask your question, and linking here if you feel it absolutely necessary. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
VAN0 Posted March 4, 2014 Share Posted March 4, 2014 Sure things. Will do that. Thanks P.S. Perhaps automatic locking or archiving old topics could be implemented? P.P.S. a few years back there was a nazi moderator who was giving temp bans left and right to people who asked questions that were previously discussed...and don't you dare complain about it or even worse - create a new account - instant perm ban right there. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2014 Moderators Share Posted March 4, 2014 VAN0, temp bans left and right to people who asked questions that were previously discussedThat does not happen now - but as explained, we would prefer that you open a new thread. even worse - create a new account - instant perm ban right thereBut if you were to try to evade a ban in that way, you would still suffer the same penalty. So the best advice is - do not get banned in the first place! 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...
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