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:#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
Last edited by leonjun16; 09-07-2012 at 08:19 AM.
THE MOST SCARIEST AND EXCITED PART IN CODING IS 【DEBUGGING】.
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]
leonjun16 (09-08-2012)
i have make like this to test the apply button working or not, but unfortunately its not working again ..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; }
THE MOST SCARIEST AND EXCITED PART IN CODING IS 【DEBUGGING】.
try using IsDlgButtonChecked..
[img]https://i43.photobucke*****m/albums/e367/DeteSting/Steam-update.gif[/img]