HelpRADIO BUTTON CONTROL

Posts 1–4 of 4 · Page 1 of 1
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
send BM_GETCHECK message to your radio buttons specifing WPARAM and LPARAM parameters as NULL and if its checked it will return BST_CHECKED
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 ..
try using IsDlgButtonChecked..
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us