Азбука программирования в Win32 API


Азбука программирования в Win32 API - стр. 93


IDM_RadioButtonl, MF_BYCOMMAND); nRadioButtonld = IDM_RadioButtonl + 102; for(i = 0; i < 3; i++)

ClieckMenuItem(hMenu2, IDM_CheckButton 1 + i, MF_UNCHECKED); break;

case WM_COMMAND: switch(LOWORD(wParam)) {

case IDM^EXIT:

SendMessage(hWnd, WM_CLOSE, 0,0); break;

case IDM_RadioButton 1 : case IDM_RadioButton2: case IDM_RadioButton3: nRadioButtonld = LOWORD(wParam) + 102;

108

Cht-ckMenuRadiohem(hMenuI, lpM_RadioButtonI, IDM_RadioButton3,

LOWOR6(wParam), MF_BYCOMMAND); break;

case IDM_CheckButtonl: case IDM_CheckButton2: case IDM_CheckButton3: i - LOWORD(wParam) - 105; uCheckBoxesState[i] = uCheckBoxesState[i] == MF_CHECKED ?

MF_UNCHECKED : MF_CHECKED; ChcckMenuItcm(liMenu2, LOWORD(wParam), MF_BYCOMMAND

uCheckBoxesState[i]); break;

case IDM_DisplayDialog:

DialogBox(hInst, "ButtonsExample", hWnd, ButtonsExampleDialogProc); break; }

break;

case WMJ5ESTROY: PostQu i tMcssage(O); return 0; i return DefWindowProc(hWnd,Message,wParam, IParam);

BOOL CALLBACK. ButtonsExampleDialogProc(HWND hDIg, UINT Message,

WPARAM wParam, LPARAM IParam)

f \

int i;

char cMyMcssage[SO];

switch(Messagc)

f

case WMJNITDIALOG: // Set slates of controls

ScndDlgltemMcssageOiDlg. nRadioButtonld, BM SETCHECK,

BST_CHECKED, 0);

lbr(! -- [DC CHECKBOX!; i <- IDC_CHECKBOX3; i++) if(uCheckBoxesState[i - 208])

SeiidDlgItemMessagc(hDlg, i, BM_SETCHECK, BST_CHECKED, 0); return TRUE: case WM_COMMAND: swilch(LOWORD(wParanv)

case IDC_RADIOBUTTON1: case IDC_RADIOBUTTON2: case IDC_RADIOBUTTON3:

sprintf(cMyMcssage,"Message from RadioButton%d", LOWORD(wParam) - 203);

109

SendDlgItemMessage(hDlg,IDC_STATUSBAR,SB_SETTEXT,

(WPARAM) 0, (LPARAM) cMyMessagc);

CheckMenuRadioItem(GetSubMenu(GetSubMenu(GetMenu(hWnd), 1), 0), IDM_RadioButton 1, IDM_RadioButton3, LOWORD(wParam)- 102, MF_BYCOMMAND); return FALSE; caseHXJCHECKBOXl: case IDC_CHECKBOX2: caseIDC_CHECKBOX3: sprintf(cMyMessage,"Message from CheckBox%d",

LOWORD(wParam) - 207); SendDlgItemMessage(hDlg,IDC_STATUSBAR,SB_SETTEXT,




Начало  Назад  Вперед



Книжный магазин