Jump to content
Shoby

How to check whether the checkbox is checked or not ?

Recommended Posts

Shoby

Hello,

I am working on .NET application which has checkboxes. So, i have to validate those checkbox controls whether they have checked or not.

I have used following code to test these but none works for me..

1. ControlCommand(("Task Wizard","","[NAME:chPrefixWSName]","IsChecked","") Returns 0. Same command for "IsEnabled", "Check"  is working; "Uncheck" not working.

2. GUICtrlRead("[NAME:chPrefixWSName]") Returns 0

3. GUICtrlGetState("[NAME:chPrefixWSName]") Returns -1

Always returns false even though the checkbox is checked. Is there any problem with the environment or AutoIT?

Can anyone help me on this ?

 

Share this post


Link to post
Share on other sites
MilesAhead

Try BM_GETCHECK message

with _WinAPI_SendMessageTimeout()

The timeout keeps your program from hanging if the target window does not respond.

Edit: Somehow you have to get the hwnd of the target.

Edited by MilesAhead

Share this post


Link to post
Share on other sites
MikahS

Hope these links within this link help you out: Link


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Shoby

Hello Mikah ,

 

Thanks for the link. But the link is mostly about getting the .NET control handle. In my case i got the handle, Only thing is I couldnt get the state of the checkbox through autoIT as well as WInAPI..

 

Is there any other way or Autoit has its own limitations regarding to .NET checkbox control. I am confused..

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

×