Mechaflash Posted July 11, 2012 Share Posted July 11, 2012 (edited) How would I go about waiting for interaction of a window on the desktop and targeting that window? I'm making a window-organizing app (which I'll share after it's complete) and want to watch for when a window is resized/moved on the desktop. Edited July 11, 2012 by mechaflash213 Jardz 1 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2012 Share Posted July 11, 2012 I would use the GUIRegisterMsg function and look for the $WM_SYSCOMMAND actions. In my signature is a link to a demo script that I created that shows you the different messages sent by the GUI when you interact with it. The move action isn't listed, but the parameter to look for is WParam = 0xF012 for clicking on the title bar of a gui. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
PhoenixXL Posted July 11, 2012 Share Posted July 11, 2012 WM_MOVE and WM_RESIZE may help with GUIRegisterMsg My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Mechaflash Posted July 11, 2012 Author Share Posted July 11, 2012 (edited) Thanks Brew. This will work out nicely. EDIT: I'll look into it Phoenix thx. Edited July 11, 2012 by mechaflash213 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Mechaflash Posted July 11, 2012 Author Share Posted July 11, 2012 (edited) Did a miniscule test on when a new window is created. The initial _ArrayDisplay() fires the event, however opening up application windows/system windows (New firefox instance and new My Documents instance) doesn't fire it. I'm thinking GUIRegisterMsg() is only for the actual GUI created by AutoIt and not any window? EDIT: Removed $iWinCount and added it to the 0 index on $ahWinList EDIT2: Added _WinOrg_UnRegisterWindow() function to show it fires when you close the _ArrayDisplay() expandcollapse popup#include <Array.au3> ;~ HotKeySet("^!e", "_IncludeExclude") GUIRegisterMsg(0x0001, "_WinOrg_RegisterWindow") ; If Window is Created GUIRegisterMsg(0x0002, "_WinOrg_UnRegisterWindow") ; If Window is Destroyed ;~ GUIRegisterMsg(0x0003, "_WinOrg_WindowCheck") ; If Window Moves ;~ GUIRegisterMsg(0x0005, "_WinOrg_WindowCheck") ; If Window is Resized ;~ GUIRegisterMsg(0x0047, "_WinOrg_WindowCheck") ; If Window Position Changes ; Global $ahWinList Defined in _WinOrg_Initialize() _WinOrg_Initialize() _ArrayDisplay($ahWinList) _ArrayDisplay($ahWinList) While 1 Sleep(100) WEnd Func _WinOrg_Initialize() $avWinListTemp = WinList() Global $ahWinList[$avWinListTemp[0][0]] $x = 0 For $i = 1 To $avWinListTemp[0][0] If $avWinListTemp[$i][0] <> "" And _WinOrg_IsVisible($avWinListTemp[$i][1]) Then $x+=1 $ahWinList[$x] = $avWinListTemp[$i][1] EndIf Next $ahWinList[0] = $x ReDim $ahWinList[$x + 1] EndFunc Func _WinOrg_IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc Func _WinOrg_RegisterWindow($hWndGUI, $MsgID) msgbox(0,"","REGISTERED WINDOW WITH HANDLE: " & $hWndGUI) EndFunc Func _WinOrg_UnRegisterWindow($hWndGUI, $MsgID) msgbox(0,"","UNREGISTERED WINDOW WITH HANDLE: " & $hWndGUI) EndFunc Edited July 11, 2012 by mechaflash213 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Mechaflash Posted July 11, 2012 Author Share Posted July 11, 2012 (edited) Was doing some research... I believe the only way to accomplish this is to hook in WH_GETMESSAGE. However, hooks, dlls and the like are still above and beyond my knowledge of use. So at this time, I'll just use a loop gathering window handles and running checks against it. It may or may not be slower than the hook method, as hooking WH_GETMESSAGE does increase processing time, but the code would be a bit cleaner and easier to adjust/expand upon via the hook method. If I get around to implementing it via the hook method, I'll update the OP. Edited July 11, 2012 by mechaflash213 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
rover Posted July 11, 2012 Share Posted July 11, 2012 How would I go about waiting for interaction of a window on the desktop and targeting that window?I'm making a window-organizing app (which I'll share after it's complete) and want to watch for when a window is resized/moved on the desktop._WinAPI_SetWinEventHook($EVENT_SYSTEM_MOVESIZESTART, $EVENT_SYSTEM_MOVESIZEEND, $pEventProc) I see fascists... 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