Jump to content

control ID


oMBRa
 Share

Recommended Posts

how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a control

You can get a list of the classes in a window with WinGetClassList, see this function by MrCreatoR to list a window's controls.

You can get the handle of a control from its id or its class name using ControlGetHandle.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a control

Seeing that there is no [HANDLE; hwnd here] control option for the id parameter ....

Func _ControlGetID($h_wnd)
    Local $a_GetDlgCtrlID = DllCall("User32.dll", "int", "GetDlgCtrlID")
    If Not @error And $a_GetDlgCtrlID[0] > 0 Then Return $a_GetDlgCtrlID[0]
    Return SetError(1, 0, "")
EndFunc

That could fail if the control doesn't have an id though... so you may want to look at using the ClassNameNN as they suggested above.

Not sure about their functions, but I wrote one that enums a window and gathers that info using WinGetClassList().

http://www.autoitscript.com/forum/index.ph...c=32781&hl=

Edit:

After all this time, you still learn things.

I was just informed by Valik that you can in fact use the controls handle in the identifier parameter. Don't ever remember reading that as an option... tested and works (as if I had doubts).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Seeing that there is no [HANDLE; hwnd here] control option for the id parameter ....

Func _ControlGetID($h_wnd)
    Local $a_GetDlgCtrlID = DllCall("User32.dll", "int", "GetDlgCtrlID")
    If Not @error And $a_GetDlgCtrlID[0] > 0 Then Return $a_GetDlgCtrlID[0]
    Return SetError(1, 0, "")
EndFunc

That could fail if the control doesn't have an id though... so you may want to look at using the ClassNameNN as they suggested above.

Not sure about their functions, but I wrote one that enums a window and gathers that info using WinGetClassList().

http://www.autoitscript.com/forum/index.ph...c=32781&hl=

Your function return same thing like _WinAPI_GetDlgCtrlID()?

When the words fail... music speaks.

Link to comment
Share on other sites

  • Moderators

Your function return same thing like _WinAPI_GetDlgCtrlID()?

I'm sure... I forget about the api functions... could make life easier on myself huh :P ...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I get an error with autoit: there was an error in autoit3.exe. the application will be closed.

Awesome.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I get an error with autoit: there was an error in autoit3.exe. the application will be closed.

You declared a Local thingy vice a Global doohicky in line 637g.

How many times are we going to have to point that out to people... ;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

what u mean?

It was an attempt at humorous sarcasm, which must be considered a failure when that has to be pointed out... ;)

The point was, without explaining exactly what you did, and perhaps showing the code you did it with, or a short snippet of code that does the same thing, we can't help.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...