我用MFC编的MDI,运行时为什么不显示窗口呢,但是在进程中还能看到? 5
下面是代码:intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLine,intnC...
下面是代码:
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow
)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_VREDRAW | CS_HREDRAW; wndclass.lpfnWndProc = (WNDPROC)WindowProc; wndclass.hInstance = hInstance;
wndclass.cbClsExtra = NULL;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hIcon =LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor =LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName="MFC1";
RegisterClass(&wndclass);
hwnd=CreateWindow("MFC1","My MFC",WS_OVERLAPPEDWINDOW,0,0,600,600,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
while( GetMessage(&msg,NULL,0,0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} 展开
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow
)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_VREDRAW | CS_HREDRAW; wndclass.lpfnWndProc = (WNDPROC)WindowProc; wndclass.hInstance = hInstance;
wndclass.cbClsExtra = NULL;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hIcon =LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor =LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName="MFC1";
RegisterClass(&wndclass);
hwnd=CreateWindow("MFC1","My MFC",WS_OVERLAPPEDWINDOW,0,0,600,600,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
while( GetMessage(&msg,NULL,0,0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询