BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
static LPCTSTR className = NULL;
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
if(className==NULL)
{
WNDCLASS wndclass;
::GetClassInfo(AfxGetInstanceHandle(),cs.lpszClass,&wndclass);
wndclass.hCursor = AfxGetApp()->LoadCursor(IDC_CROSS);
wndclass.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
wndclass.hbrBackground = (HBRUSH)GetStockObject(25);
wndclass.lpszClassName = "MYCLASS";
VERIFY(AfxRegisterClass(&wndclass));
className = wndclass.lpszClassName;
}
// TODO: Modify the Window class or styles here by modifying
//  the CREATESTRUCT cs
cs.lpszClass = className;
cs.x = 200;
cs.y = 100;
cs.cx = 300;
cs.cy = 300;
return TRUE;
}
1,想要建立自己的主窗口,就要在这里注册自己的窗口类,并调用,是吗?
2,输入上面的代码,但看不到我所想要的背景颜色,是怎么回事呢?
请各位知道的,帮帮我?