corgano Posted January 24, 2010 Share Posted January 24, 2010 (edited) I want to find out what Control is under the mouse, and the ID or handle of it. I know this has been asked before, but I searched with google (site:autoitscript.com control from pos ,and others) and the sites search but got nothing. can anyone post an example they might have laying around? EDIT: I was secucessfully able to get the control handle and ID of any control, but the script would rather return the ID of a goop then the control in the goop. Edited January 24, 2010 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Mat Posted January 24, 2010 Share Posted January 24, 2010 (edited) _WinAPI_WindowFromPointFor example of use check out my UDF for making a finder tool here, or look on the forums for lazycats example which I based it on. Edited January 24, 2010 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2010 Moderators Share Posted January 24, 2010 corgano, Someone brought this topic to my attention earlier today. I have not used it myself, but given its pedigree it might be worth a look. 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...
corgano Posted January 24, 2010 Author Share Posted January 24, 2010 (edited) corgano, Someone brought this topic to my attention earlier today. I have not used it myself, but given its pedigree it might be worth a look. M23 DUDE Thats exactly what I was looking for. I even posted in that thread, funny I didn't remember! OK that didnt work It was returning a diffenent controlID than autoiT window tool. Any other ones i could try? Edited January 24, 2010 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
picea892 Posted January 24, 2010 Share Posted January 24, 2010 I guess this is solved. But for a simpler example you can see here. Link to comment Share on other sites More sharing options...
corgano Posted January 24, 2010 Author Share Posted January 24, 2010 I guess this is solved. But for a simpler example you can see here. Not yet... How do I get the control ID from the control handle? I tried using control click with a control handle but it didn't work. How do I get a Control ID from a control handle? This works perfectly for handle (derived by Mat's window finder tool) Func click() $INTERNAL_USER32_DLL = DllOpen("user32.dll") Local $mPos = MouseGetPos (), $hWndUnder = DllCall($INTERNAL_USER32_DLL, "hwnd", "WindowFromPoint", "long", $mPos[0], "long", $mPos[1]) FileWrite($file,'WinWaitActive("'&WinGetTitle("[ACTIVE]")&'")' & @CRLF) FileWrite($file,'ControlClick("'&WinGetTitle("[ACTIVE]")&'","",'&$hWndUnder[0]&')' & @CRLF) MouseClick("left") EndFunc 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2010 Moderators Share Posted January 24, 2010 corgano,If you have the handle, _WinAPI_GetDlgCtrlID will get you the ControlID. 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...
corgano Posted January 24, 2010 Author Share Posted January 24, 2010 (edited) Ok thank you people just in summary: $INTERNAL_USER32_DLL = DllOpen("user32.dll") Local $mPos = MouseGetPos (), $hWndUnder = DllCall($INTERNAL_USER32_DLL, "hwnd", "WindowFromPoint", "long", $mPos[0], "long", $mPos[1]) ;this will get you the handle, from mats window finder tool $ID = _WinAPI_GetDlgCtrlID($hWndUnder[0]) ;this will get you the ID Happy with how small it is! Thankyou everyone who posted Edited January 24, 2010 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
corgano Posted January 24, 2010 Author Share Posted January 24, 2010 OK new problem, I am trying to get the control handle or id of a control inside a goop, the previous script only returns the goop control ID, not the control in the goop. How do I get past this? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e 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