Vincs Posted July 16, 2010 Share Posted July 16, 2010 Hello everyone, When I’m using “AutoIt v3 Window Info” with C# application in control, I can get the name of the control I want to interact with. But when I’m “spying” a Cpp Win32 application, the field is always blank. Is there a way to get information in this field? Do you know a way to identify individually each component of a Cpp Win32 App? Even by adding code into the application itself. Thanks for your help. Link to comment Share on other sites More sharing options...
Mat Posted July 16, 2010 Share Posted July 16, 2010 Names are only used by .Net controls, you want to use the stuff under "Windows Titles and text (advanced)" in the helpfile. You could use class names and instances for example. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Vincs Posted July 16, 2010 Author Share Posted July 16, 2010 I'm currently using class names and instances and I'm seeking for another way to identify component. A more precise way, that is directly linked to the component it self. Link to comment Share on other sites More sharing options...
KaFu Posted July 16, 2010 Share Posted July 16, 2010 (edited) Looking at the _WinAPI_GetWindowLong($hWnd, $iIndex) UDF there's an Index called $GWL_USERDATA...Though the MSDN article for SetWindowLong says "This data is intended for use by the application that created the window.", maybe theres a way to fill that info with a custom index and use it in AutoIt?Edit: Nope, after some testing it does not seem to be accessible .Edit #2: "Sets the 32-bit value associated with the window"... encode your values or just make up an index of yourself.Compile and run TargetGUI.au3, then run Check.au3 to read the $GWL_USERDATA from the TargetGUI.au3.TargetGUI.au3#include <winapi.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> GUICreate("Test-My-GUI") $c_Button = GUICtrlCreateButton("Test", 10, 10, 200) ConsoleWrite(_WinAPI_SetWindowLong(GUICtrlGetHandle($c_Button), $GWL_USERDATA, 6) & @crlf) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $c_Button MsgBox(0, "", _WinAPI_GetWindowLong(GUICtrlGetHandle($c_Button), $GWL_USERDATA)) EndSwitch WEnd GUIDelete()Check.au3#include <_EnumChildWindows.au3> #include <array.au3> #include <constants.au3> $hWnd = WinGetHandle("Test-My-GUI", "") $aEnumList = _EnumChildWindows($hWnd) _ArrayDisplay($aEnumList) For $i = 1 To UBound($aEnumList) - 1 MsgBox(0, "", $aEnumList[$i][0] & @crlf & _WinAPI_GetWindowLong($aEnumList[$i][0], $GWL_USERDATA)) Next_EnumChildWindows Edited July 16, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Vincs Posted July 19, 2010 Author Share Posted July 19, 2010 Thanks for your help. Unfortunately I don't have a graphical project in which I can edit the code to set the SetWindowLong. I will try this in a short time. Link to comment Share on other sites More sharing options...
Vincs Posted August 3, 2010 Author Share Posted August 3, 2010 (edited) Sorry the delay.EDIT : Ok my bad I wasn't setting the button correctlyI've got the get the handle first then set it.SetWindowLongPtr(Dlg,GWLP_USERDATA,(__int3264)(LONG_PTR)56); HWND hButton = ::GetDlgItem(Dlg,IDC_LIRE); SetWindowLongPtr(hButton,GWLP_USERDATA,(__int3264)(LONG_PTR)56);I'm finally trying to work this out.The sample that you gave me work just fine.I've take a sample project from the web and try to modify it to set the SetWindowLongPtr:ProjectI've set it this way:SetWindowLongPtr(Dlg,GWLP_USERDATA,(__int3264)(LONG_PTR)56); SetWindowLongPtr((HWND)IDC_LIRE,GWLP_USERDATA,(__int3264)(LONG_PTR)56);When I'm trying to get the value for the button "Lire" from AutoIt I get 0 as value.But for the window it's equal to 56 as I set it.MsgBox(0,"", _WinAPI_GetWindowLong($hWnd,$GWL_USERDATA))Do you know what I'm doing wrong ? Edited August 3, 2010 by Vincs Link to comment Share on other sites More sharing options...
KaFu Posted August 3, 2010 Share Posted August 3, 2010 Sorry, I'm not familiar with c, better ask this question in the developer forum. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Vincs Posted August 5, 2010 Author Share Posted August 5, 2010 Sorry, I'm not familiar with c, better ask this question in the developer forum.I edited my topic.It works, thanks to you ! 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