编程时碰到的一个怪问题
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 400;
cs.cy = 300;
cs.lpszName ="HZY";
//cs.style &= ~FWS_ADDTOTITLE;
cs.style = WS_OVERLAPPEDWINDOW;
WNDCLASS wndclass;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor = LoadCursor(NULL,IDC_HELP);
wndclass.hIcon = LoadIcon(NULL,IDI_ERROR);
wndclass.hInstance = AfxGetInstanceHandle();
wndclass.lpfnWndProc = ::DefWindowProc;
wndclass.lpszClassName = "huangzhiyang";
wndclass.lpszMenuName = NULL;
wndclass.style = CS_HREDRAW ¦ CS_VREDRAW;
if(!RegisterClass(&wndclass))
{
MessageBox("hahaha");
}
cs.lpszClass = "huangzhiyang";
return TRUE;
}
这里面用了 if(!RegisterClass(&wndclass)) 会跳出对话框显示hahaha
但是改成 if(RegisterClass(&wndclass))后还是会跳出该对话框,
不知道是什么原因?