[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

BM_GETCHECK and BM_SETCHECK and .NET controls

ME

11/21/2007 2:40:00 AM

I have googled this quite a bit and I just can't find the answer. I need to
read the state of a radio button in another process. Not much is known
about the other process, other than the fact that it was created with .NET
controls. I have read on various forums that SendMessage(conrolhandle,
BM_GETCHECK, 0,0) does not work on .NET controls. I have found this to be
true as the code that previosly worked on a NON .net radio button returned
the state of the radio button. However the control created in .NET only
returns 0 for its state, regardless of whether it is checked or not. For
BM_SETCHECK I have found that the control simply ignores the message.

I am using VS 2005, C# (but can easily read vb). Does anyone know of a
resource or a document that can help me?

Thanks,

Matt

Here is one of the several examples I found but did not have an answer to.
This example is exactly as it occurs for me:
http://www.vb-forum.com/showthread.ph...


5 Answers

Juergen Thuemmler

11/21/2007 6:00:00 AM

0


> I need to read the state of a radio button in another process. Not much
> is known
> about the other process, other than the fact that it was created with .NET
> controls. I have read on various forums that SendMessage(conrolhandle,
> BM_GETCHECK, 0,0) does not work on .NET controls.

As a workaround, you can check the controls style for WS_MAXIMIZEBOX. If it
is set, the radio button is checked. I played around with Spy++ and found
this working for option button, but not for checkboxes. A better method is
to use the Active Accessibility for checking the role and state of the
control. The classic "window view" gives you only a buttonlike class for
option buttons and checkboxes, but with accessibility (see
AccessibleObjectFromWindow() function) you get the correct information about
the control and its state.

Juergen.


Bob Butler

11/21/2007 2:11:00 PM

0

"ME" <trash.trash@comcast.netREMOVETHIS> wrote in message
news:c7SdnZKKvcjiB97anZ2dnUVZ_j6dnZ2d@comcast.com...
<cut>
> I am using VS 2005, C# (but can easily read vb).

You can read VB or VB.Net? They are very different languages.


--
You need to ask in a newsgroup with "dotnet" in the name. This group is for
VB 6.0 and earlier and does not include VB.Net or VB 200x.

ME

11/21/2007 4:33:00 PM

0

I can read both (I actually learned on VB 4.0, 6.0, and VB.NET but got my
MCSD in C#.

Thanks,

Matt

"Bob Butler" <noway@nospam.ever> wrote in message
news:uJ3I7hELIHA.1208@TK2MSFTNGP05.phx.gbl...
> "ME" <trash.trash@comcast.netREMOVETHIS> wrote in message
> news:c7SdnZKKvcjiB97anZ2dnUVZ_j6dnZ2d@comcast.com...
> <cut>
>> I am using VS 2005, C# (but can easily read vb).
>
> You can read VB or VB.Net? They are very different languages.
>
>
> --
> You need to ask in a newsgroup with "dotnet" in the name. This group is
> for VB 6.0 and earlier and does not include VB.Net or VB 200x.
>


ME

11/21/2007 4:52:00 PM

0

Juergen,

Thank you. The Accessiblity idea solved my GET problem completely. I
enjoyed learning a bit about that and look forward to learning more. I
managed to retrieve the value through the IAccessible interface. In my
research to get this accomplished I noticed that the Accessiblity Explorer
can "set" the value of a .net checkbox. This is also something I am not
able to do via BM_SETCHECK and I am hoping to be able to pull it off via
IAccessible. Do you know of any information that can direct me in setting
the checkbox via IAccessible as the Accessible Explorer does? Is this even
possible? As you can tell I very green to Accessiblity and could use a
little direction.

Thanks,

Matt

Accessible Explorer
http://www.microsoft.com/downloads/details.aspx?FamilyId=3755582A-A707-460A-BF21-1373316E13F0&disp...




"Juergen Thuemmler" <thue@removethisgmx.de> wrote in message
news:%23uoV6OALIHA.484@TK2MSFTNGP06.phx.gbl...
>
>> I need to read the state of a radio button in another process. Not much
>> is known
>> about the other process, other than the fact that it was created with
>> .NET controls. I have read on various forums that
>> SendMessage(conrolhandle, BM_GETCHECK, 0,0) does not work on .NET
>> controls.
>
> As a workaround, you can check the controls style for WS_MAXIMIZEBOX. If
> it is set, the radio button is checked. I played around with Spy++ and
> found this working for option button, but not for checkboxes. A better
> method is to use the Active Accessibility for checking the role and state
> of the control. The classic "window view" gives you only a buttonlike
> class for option buttons and checkboxes, but with accessibility (see
> AccessibleObjectFromWindow() function) you get the correct information
> about the control and its state.
>
> Juergen.
>


Juergen Thuemmler

11/21/2007 7:59:00 PM

0

> IAccessible. Do you know of any information that can direct me in setting
> the checkbox via IAccessible as the Accessible Explorer does? Is this
> even possible? As you can tell I very green to Accessiblity and could use
> a little direction.

Have a look at IAccessible::get_accDefaultAction and
IAccessible::accDoDefaultAction. Depending on the state of the checkbox, the
DefaultAction will be either Check or Uncheck.

Juergen.