Jump to content

from au3 script trying to controling UI in delphi application


mpechner
 Share

Recommended Posts

I have been racking my brains out trying to query a checkbox and possibly set the value of the checkbox.

I first tried to no avail:

;state global set to "Check" or "UnCheck"

Func flipCheckbox($controlId)

ControlFocus($title, "", $controlId); Shows me the correct control is being queried

sleep(250)

ControlCommand($title, "", $controlId, $state, "")

ConsoleWrite($controlId&" state"&$state&@CRLF);

$ctlstate = ControlCommand($title, "", $controlId, "IsChecked", "")

ConsoleWrite($controlId&" state"&$state&" cur st:"&$ctlstate&@CRLF);

If $state == "Check" And Not $ctlstate == 1 Then

ConsoleWrite("Could turn on flip:"&$controlId)

Cleanup($LOGFILE, "Could turn on flip:"&$controlId);

ElseIf $state == "Uncheck" And Not $ctlstate == 0 Then

ConsoleWrite("Could turn off flip:"&$controlId)

Cleanup($LOGFILE, "Could turn off flip:"&$controlId)

EndIf

EndFunc

Now I am trying things at a lower level:

Chandle returns the same value as autoit info.

$chandle = ControlGetHandle($title, "", "TResTeCheckBox6");

;MsgBox(0, "hh", $chandle);

flipCheckbox("[Class:TResTeCheckBox;Instance:6]")

$BM_GETCHECK = 0x00F0

$BM_SETCHECK = 0x00F1

$BM_GETSTATE = 0x00F2

$BM_SETSTATE = 0x00F3

$BM_CLICK = 0x00F5

$BST_UNCHECKED = 0x0000

$BST_CHECKED = 0x0001

$BST_INDETERMINATE = 0x0002

;

; Final attempt

;

ConsoleWrite("check"&@CRLF);

DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )

sleep(4000)

ConsoleWrite("check"&@CRLF);

DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )

sleep(4000)

ConsoleWrite("check"&@CRLF);

DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_CLICK, "wparam", 0, "lparam", 0 )

sleep(4000)

;

;Next to last attempt

;

;ConsoleWrite("check"&@CRLF);

;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_CHECKED, "lparam", 0 )

;sleep(4000)

;ConsoleWrite("uncheck"&@CRLF);

;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_UNCHECKED, "lparam", 0 )

;sleep(4000)

;ConsoleWrite("check"&@CRLF);

;DllCall("user32.dll","uint", "SendMessage","hwnd", $chandle, "uint", $BM_SETCHECK, "wparam", $BST_CHECKED, "lparam", 0 )

;sleep(4000)

What am I doing wrong?

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