Sign in to follow this  
Followers 0
platypoos

ControlID

9 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



When you create your own autoit gui the controls you create return the control id

$hControlID = GUICtrlCreateButton

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.

Share this post


Link to post
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)
GuiSetState()

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




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

How do I find out the control id of $button1

Share this post


Link to post
Share on other sites

The controlID is stored in the variable $button1.

In other words, $button1 IS THE CONTROL ID.


Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Would $button1 be the control id

Edited by platypoos

Share this post


Link to post
Share on other sites

OOHH, thanks guys :)

:(

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

thanks

:(

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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
GUICreate("test")
$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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0