Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2007

Tip: Looking for answers? Try searching our database.

BM_GETCHECK and BM_SETCHECK and .NET controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ME - 21 Nov 2007 02:39 GMT
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.php?t=480772
Juergen Thuemmler - 21 Nov 2007 05:59 GMT
> 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.
ME - 21 Nov 2007 16:52 GMT
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&displaylang=en


>> I need to read the state of a radio button in another process.  Not much
>> is known
[quoted text clipped - 13 lines]
>
> Juergen.
Juergen Thuemmler - 21 Nov 2007 19:59 GMT
> 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.
Bob Butler - 21 Nov 2007 14:10 GMT
<cut>
> I am using VS 2005, C# (but can easily read vb).

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

Signature

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 - 21 Nov 2007 16:33 GMT
I can read both (I actually learned on VB 4.0, 6.0, and VB.NET but got my
MCSD in C#.

Thanks,

Matt

> <cut>
>> I am using VS 2005, C# (but can easily read vb).
>
> You can read VB or VB.Net?  They are very different languages.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.