hwndButton = CreateWindow( "BUTTON", // predefined class "OK", // button text WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON , // styles
// Size and position values are given explicitly, because // the CW_USEDEFAULT constant gives zero values for buttons. 10, // starting x position 10, // starting y position 100, // button width 100, // button height hwnd, // parent window NULL, // No menu (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); // pointer not needed
你看下 MSDN 吧,里边讲解的很清楚。
static BOOL SelectEditionMsg(HWND hDlg, UINT message, WPARAM wParam) { switch (message) { case WM_INITDIALOG: /* int ncount = C_GetProjectCount(); pProjects = new Project[ncount]; for ncount pProjects[i].szProjectName = Loadproject(i); pProjects[i].checkid = CreateWindow(checkbox); end */ pProjects = new Project; strcpy(pProjects->szProjectName , "jian4"); pProjects->checkid =(int) ::CreateWindow(NULL,"test",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON,0,0,20,20,hDlg,NULL,NULL,NULL);
在 对话框 打开时创建:m_radio4.CreateWindow();
"BUTTON", // predefined class
"OK", // button text
WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON , // styles
// Size and position values are given explicitly, because
// the CW_USEDEFAULT constant gives zero values for buttons.
10, // starting x position
10, // starting y position
100, // button width
100, // button height
hwnd, // parent window
NULL, // No menu
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
NULL); // pointer not needed
/* int ncount = C_GetProjectCount();
pProjects = new Project[ncount];
for ncount
pProjects[i].szProjectName = Loadproject(i);
pProjects[i].checkid = CreateWindow(checkbox);
end
*/
pProjects = new Project;
strcpy(pProjects->szProjectName , "jian4");
pProjects->checkid =(int) ::CreateWindow(NULL,"test",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON,0,0,20,20,hDlg,NULL,NULL,NULL);
//::SetFocus(hDlg);
return true;这样写有哪里是错的么