Jump to content

Recommended Posts

Posted

Yep :lmao: However, determining if a button is a normal button or radio button or checkbox is a bit tricker.... see code at end of my post.

#include <GuiConstants.au3>

$GUI = GuiCreate("Example")
$one = GUICtrlCreateButton("This one is a button", 10, 10)
$two = GuiCtrlCreateLabel("This two is a label", 100, 100)
$three = GuiCtrlCreateEdit("three = input box", 200, 200, 100, 100)
GuiSetState()


MsgBox(4096, "one", _GetClassName($GUI,$one))
MsgBox(4096, "two", _GetClassName($GUI,$two))
MsgBox(4096, "three", _GetClassName($GUI,$three))

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func _GetClassName($title, $GuiCtrlRef)
    Local $lpstr;required for DllCall(...GetClassName..) I think
    Local $handle = ControlGetHandle($title, "", $GuiCtrlRef)
    Local $class = DllCall("user32.dll", "int", "GetClassName", "hWnd", $handle, "str", $lpstr, "int", 255)
    Return $class[2]
EndFunc

Func _GetStyle($title, $GuiCtrlRef)
    $foo = ControlGetHandle($title, "", $GuiCtrlRef)
    $style = DllCall("user32.dll","Long","GetWindowLong","hWnd",$foo,"int",-16)
    Return $style[0]
EndFunc

Here's the code for determining if a "button" is a pushbutton or checkbox or radio or frame. A simple BitAND will not work because the styles are not simply powers of two....

CODE

$type = BitAND($s, 0xF) ;look at last four bits...

If $type = 2 or $type = 3 or $type = 5 or $type = 6 Then

; checkbox...

ElseIf $type = 4 or $type = 9 Then

; radio...

ElseIf $type = 7 Then

; group ...

Else

; normal button ...

EndIf

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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...