Jump to content

How to get Checkbox State for a .NET application?


ChiGGz
 Share

Recommended Posts

Hey guys,

I have problems trying to properly access a CheckBox within an application programmed in C++ .NET

I am able to toggle the CheckBox via

ControlCommand ( $hWndAccount, "", $autoRKeyIKE_CID, "Check", "" )

but am not able not UNCHECK and more importantly, use the ISCHECKED function.

Please help if you can. It is absolutely important to my program that I am able to properly modify a CheckBox !

Thank-you very much

Edited by ChiGGz
Link to comment
Share on other sites

What is the au3info information for the control ?

Hey Jos, not exactly sure what info you are looking for, but here is all of it

>>>> Window <<<<

Title: Create New VPN Account

Class: WindowsForms10.window.8.app.0.378734a

Position: 193, 217

Size: 656, 510

Style: 0x16C80000

ExStyle: 0x00010300

Handle: 0x00B902EC

>>>> Control <<<<

Class: WindowsForms10.BUTTON.app.0.378734a

Instance: 13

ClassnameNN: WindowsForms10.BUTTON.app.0.378734a13

ID: 12977202

Text: Propose All

Position: 142, 111

Size: 79, 17

ControlClick Coords: 57, 11

Style: 0x5601000B

ExStyle: 0x00000000

Handle: 0x00C60432

This will be an issue if it cannot be figured out :D

Edited by ChiGGz
Link to comment
Share on other sites

  • Developers

I have had it several times that the control wasn't detected properly because its not a real s"standard" one and resorted doing a Send() command to it.

The {NUMPADADD} will do a select and {NUMPADSUB} will de-select.

But you mention a Radio control and are you sure you cna deselect it ? Normally radio controls is a set and one of them is selected which auto-deselect the others.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I have had it several times that the control wasn't detected properly because its not a real s"standard" one and resorted doing a Send() command to it.

The {NUMPADADD} will do a select and {NUMPADSUB} will de-select.

But you mention a Radio control and are you sure you cna deselect it ? Normally radio controls is a set and one of them is selected which auto-deselect the others.

My apologies, it is actually a Check Box. the CHECK function in sendcommand toggles it on and off. The others do not work however (uncheck, ischecked)

I am pressing numpadd +/- right now and it does nothing. However spacebar toggles it.

I really need a way to find thecurrent state of the checkbox

Edited by ChiGGz
Link to comment
Share on other sites

  • Developers

My apologies, it is actually a Check Box. the CHECK function in sendcommand toggles it on and off. The others do not work however (uncheck, ischecked)

Does doing send({numpadadd}) work?

I am pressing numpadd +/- right now and it does nothing

You will have to set the focus to the control first ... could be done with the proper Alt+Character combo when it has one or sending tabs.

or try ControlSend() to send it to the correct control.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You will have to set the focus to the control first ... could be done with the proper Alt+Character combo when it has one or sending tabs.

or try ControlSend() to send it to the correct control.

Unfortunately this does not work either for add and sub.

ControlSend($hWndAccount,"", $propAllIKE_CID, "{numpadadd}")
Link to comment
Share on other sites

Try

#Include <Misc.au3>

Global Const $BM_SETCHECK = 0xF1
Global Const $BM_GETSTATE = 0xF2
Global Const $BST_INDETERMINATE = 0x2
Global Const $BST_CHECKED = 0x1
Global Const $BST_UNCHECKED = 0x0

$hCheck = ControlGetHandle("Create New VPN Account", "", "Propose All")
If IsHWnd($hCheck) Then
    $i = _SendMessage($hCheck, $BM_GETSTATE, 0, 0)
    MsgBox(0,'','State = ' & $i)
;~  _SendMessage($hCheck, $BM_SETCHECK, $BST_CHECKED, 0)
EndIf

"be smart, drink your wine"

Link to comment
Share on other sites

Try

#Include <Misc.au3>

Global Const $BM_SETCHECK = 0xF1
Global Const $BM_GETSTATE = 0xF2
Global Const $BST_INDETERMINATE = 0x2
Global Const $BST_CHECKED = 0x1
Global Const $BST_UNCHECKED = 0x0

$hCheck = ControlGetHandle("Create New VPN Account", "", "Propose All")
If IsHWnd($hCheck) Then
    $i = _SendMessage($hCheck, $BM_GETSTATE, 0, 0)
    MsgBox(0,'','State = ' & $i)
;~  _SendMessage($hCheck, $BM_SETCHECK, $BST_CHECKED, 0)
EndIf
Hi Siao,

It almost worked! But it detects the state change of the check box the first time (gives a value of 8 when stat changes). If I change it again and check the value is still 8. So it seems to only detect state changes and not retrieve the value of the checkbox. Also, is it supposed to be giving me an 8?

EDIT: Upon inspect your code works on the taskbar properties were it returns a value of 9 or 8. So I guess it does not on an application created by .NET?

Edited by ChiGGz
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...