CheckRadioButton怎么木有用啊
程序代码:
#include <windows.h> #include "resource.h" #include "CDlg.h" LRESULT CALLBACK WndProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { TCHAR szClsName[]=TEXT("ClassName"); CDLG dlg; WNDCLASS wndcls; wndcls.cbClsExtra=NULL; wndcls.cbWndExtra=DLGWINDOWEXTRA; wndcls.hbrBackground=(HBRUSH)COLOR_WINDOW; wndcls.hCursor=LoadCursor(NULL,IDC_ARROW); wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION); wndcls.hInstance=hInstance; wndcls.lpfnWndProc=WndProc; wndcls.lpszClassName=szClsName; wndcls.lpszMenuName=NULL; wndcls.style=CS_HREDRAW|CS_VREDRAW; dlg.RegisterClass(&wndcls); dlg.BuildWindow(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,NULL); dlg.ShowWindow(nShowCmd); return dlg.Run(); } LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch(uMsg) { case WM_CREATE: CheckRadioButton(hwnd,IDC_RADIO1,IDC_RADIO2,IDC_RADIO1); //CheckRadioButton return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd,uMsg,wParam,lParam); }注:CDlg是我自己封装的类,为何 我在WM_CREATE消息中加了CheckRadioButton(hwnd,IDC_RADIO1,IDC_RADIO2,IDC_RADIO1); 但是RADIO1木有被选中的标记呀?
为方便大家分析错误
我把工程 文件发上来
对话框.zip
(1.91 MB)