Sonic and Sega Retro Message Board: Help with win32 app in windows using C++ - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Help with win32 app in windows using C++ radio buttons and such

#1 User is offline Alriightyman 

Posted 15 June 2010 - 05:00 PM

  • !!!!!!!!!!!!!!!!!
  • Posts: 351
  • Joined: 27-November 07
  • Gender:Male
  • Location:Largo, Fl
  • Project:0101001101101111011011100110100101100011 00000010: 0101001100000011 01000101011001000110100101110100011010010110111101101110
  • Wiki edits:5
I'm still learning Win32 apps in C++, and I can't seem to find any information on how to check if a radio button or checkbox button is checked. I can find it for using MCF apps, but I'd like to stay away from that for now.
Anyway, I created a dialog box with a few radio buttons and a couple "normal" buttons, and when the user clicks on one of the "normal" buttons, the program should check which radio button is checked and do something different.
Example:
CODE
// other code... in dialog message loop
switch (LOWORD(wParam)) {

    case IDC_NORMAL_BUTTON:
      {
            if ( /* check if radio button is checked */ )   //  unsure how to do this... in win32
                       Function1();
             else
                       Function2();
// other code...

Any advice or help would be great!!
Thanks.

#2 User is offline Synergy 

Posted 15 June 2010 - 06:02 PM

  • Posts: 90
  • Joined: 20-February 10
  • Gender:Male
  • Location:UK
Send a BM_GETCHECK message, using the control's handle as parameter. Return value gives you its state.

CODE
if(SendMessage(hCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
{
  // code here
}

This post has been edited by Synergy: 15 June 2010 - 06:03 PM

#3 User is offline Alriightyman 

Posted 15 June 2010 - 06:47 PM

  • !!!!!!!!!!!!!!!!!
  • Posts: 351
  • Joined: 27-November 07
  • Gender:Male
  • Location:Largo, Fl
  • Project:0101001101101111011011100110100101100011 00000010: 0101001100000011 01000101011001000110100101110100011010010110111101101110
  • Wiki edits:5
QUOTE (Synergy @ Jun 15 2010, 07:02 PM)
Send a BM_GETCHECK message, using the control's handle as parameter. Return value gives you its state.

CODE
if(SendMessage(hCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
{
  // code here
}

Awsome! Thanks a lot!

#4 User is offline Sintendo 

Posted 16 June 2010 - 02:31 AM

  • Posts: 249
  • Joined: 15-June 04
  • Gender:Male
  • Wiki edits:2
Or you can use this macro.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users