Results 1 to 4 of 4
  1. #1
    leonjun16's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0

    RADIO BUTTON CONTROL

    Code:
    #define WIN32_LEAN_AND_MEAN
    
    #include <windows.h>
    
    #include "resource.h"
    
    HINSTANCE hInst;
    HWND hWndDlg;
    
    BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        switch(uMsg)
        {
            case WM_INITDIALOG:
                return TRUE;
    
            case WM_CLOSE:
                EndDialog(hwndDlg, 0);
                return TRUE;
    
            case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                    case IDC_BTN_QUIT:
                        EndDialog(hwndDlg, 0);
                        return TRUE;
    
                    case IDC_BTN_APPLY:
                         //Once press apply button, user who ticks the option will be process, But how? :(
                        break;
                        return TRUE;
                }
        }
    
        return FALSE;
    }
    
    
    int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
        hInst = hInstance;
    
        // The user interface is a modal dialog box
        return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
    }


    This is the 'skeleton code' of my GUI application.
    Once user press apply button, the option which is ticks by user will be process.
    But how i code that? I tried googled but nothing comes up
    Attached Thumbnails Attached Thumbnails
    WDE.PNG  

    Last edited by leonjun16; 09-07-2012 at 08:19 AM.
    THE MOST SCARIEST AND EXCITED PART IN CODING IS 【DEBUGGING】.

  2. #2
    giniyat101's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Not telling.
    Posts
    1,935
    Reputation
    130
    Thanks
    1,380
    My Mood
    Dead
    send BM_GETCHECK message to your radio buttons specifing WPARAM and LPARAM parameters as NULL and if its checked it will return BST_CHECKED


     



    [img]https://i43.photobucke*****m/albums/e367/DeteSting/Steam-update.gif[/img]

  3. The Following User Says Thank You to giniyat101 For This Useful Post:

    leonjun16 (09-08-2012)

  4. #3
    leonjun16's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by giniyat101 View Post
    send BM_GETCHECK message to your radio buttons specifing WPARAM and LPARAM parameters as NULL and if its checked it will return BST_CHECKED
    Code:
    BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        int Selection;
        HWND hwndSHUTDOWN;
    
        switch(uMsg)
        {
            case WM_INITDIALOG:
                hwndSHUTDOWN = GetDlgItem(hWndDlg, IDC_SHUDOWNAFTER);
                SendMessage(hwndSHUTDOWN,BM_GETCHECK,0,0);
                return TRUE;
    
            case WM_CLOSE:
                EndDialog(hwndDlg, 0);
                return TRUE;
    
            case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                    case IDC_BTN_QUIT:
                        EndDialog(hwndDlg, 0);
                        return TRUE;
    
                    case IDC_BTN_APPLY:
                        if (SendDlgItemMessage(hwndSHUTDOWN,IDC_SHUDOWNAFTER,BM_GETCHECK,0,0)==BST_CHECKED)
                        {
                            MessageBox(NULL,"TEST","TEST",NULL);
                        }
                        break;
                        return TRUE;
                }
        }
    
        return FALSE;
    }
    i have make like this to test the apply button working or not, but unfortunately its not working again ..
    THE MOST SCARIEST AND EXCITED PART IN CODING IS 【DEBUGGING】.

  5. #4
    giniyat101's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Not telling.
    Posts
    1,935
    Reputation
    130
    Thanks
    1,380
    My Mood
    Dead
    try using IsDlgButtonChecked..


     



    [img]https://i43.photobucke*****m/albums/e367/DeteSting/Steam-update.gif[/img]

Similar Threads

  1. [help] Radio button spamming
    By khaozizleet in forum Visual Basic Programming
    Replies: 4
    Last Post: 10-23-2010, 09:32 AM
  2. Them buttons?
    By OutZida in forum Art & Graphic Design
    Replies: 2
    Last Post: 02-06-2006, 04:55 AM
  3. Banner/Button for advertising
    By Dave84311 in forum Help & Requests
    Replies: 17
    Last Post: 01-27-2006, 08:59 AM
  4. CBS Controls StarTrek
    By Dave84311 in forum SCI-FI
    Replies: 5
    Last Post: 01-22-2006, 11:18 PM