下面的程序段为何不显示窗口,我是在找不出错误,以致下面的编程无法进行,望高手尽快指点,先谢了
#include <windows.h>
//函数声明
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
//主函数
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char lpszClassName[]="三角形有限单元法";
//定义窗口类
WNDCLASS wc;
wc.style=0;
wc.lpfnWndProc=WndProc;
wc.cbClsExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(hInstance,IDI_APPLICATION);
wc.hCursor=LoadCursor(hInstance,IDC_ARROW);
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName=NULL;
wc.lpszClassName=lpszClassName;
//注册窗口类
if(!RegisterClass(&wc))
{
MessageBeep(0);
return FALSE;
}
//创建窗口
HWND hWnd;
hWnd=CreateWindow(lpszClassName,
"三结点三角形有限单元法",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
//显示窗口
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
//进入消息循环
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
//窗口处理函数
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
return(0);
}