Jump to content


Recommended Posts

Ok, I do realize this is probably the dumbest post ever posted... but how do i find out the controlID of an item (in this case, a button)

I've searched the forums, and it always says something about the value being returned or given, WHERE??

Does it say somewhere.

I do know i can use the autoit windows tool, but I'm 100% positive theres another proper way.

Where is the controlID returned.

Thanks in advance

EDIT: Actually I may be wrong, is the window info tool the only way.. after reading another post...

EDIT Again: I am creating my own gui, not automating anything else.

Edited by platypoos
Link to comment
Share on other sites

What do you mean "Returns the control id"

Where does it return....??

Please help

GuiCreate("Test 123",351,268,452,322)
$button1=GuiCtrlCreateButton("Begin Test",97,141,152,96)

While 1
If $msg=-3 Then Exit
If $msg=$button1 Then button1()

Func button1()
    msgbox (0,"test successful","TEST123ABC")

How do I find out the control id of $button1

Link to comment
Share on other sites

the value held in the variable $button1 is the control id in your code

in the example i posed it would be help in $hControlID

$button1 = GuiCtrlCreateButton("Begin Test",97,141,152,96)

^ holds the controlid

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

For the purpose of completeness, this is another way for any button.

Local $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $controlHandle) ; get the ID of the control

Where $controlHandle is the handle of the control.

This is the same as the _WinAPI_GetDlgCtrlID() funciton in AutoIt. I copy from the help file

Local $button
$button = GUICtrlCreateButton("testing", 0, 0)
MsgBox(4096, "ID", "Dialog Control ID: " & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($button)))
Edited by bo8ster

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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

  • Recently Browsing   0 members

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