学写的程序,编译没报错,但无法运行
如题,在devc4.9.9.2下编译通过,0 Error,0 Warnining .但就是不运行,毫无反应。原代码如下:#include<windows.h>
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
char szClassName[]="WindowsApp";
int WINAPI WinMain(HINSTANCE hThisIN,HINSTANCE hPrev,PSTR Lpsz,int cmdShow)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
wincl.hInstance=hThisIN;
wincl.lpszClassName=szClassName;
wincl.lpfnWndProc=WindowProcedure;
wincl.style=CS_DBLCLKS;
wincl.cbSize=sizeof(WNDCLASSEX);
wincl.hIconSm = LoadIcon (NULL,IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL,IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra =0;
wincl.cbWndExtra=0;
wincl.hbrBackground=(HBRUSH) COLOR_BACKGROUND;
if(!RegisterClassEx(&wincl))
return 0;
hwnd=CreateWindowEx(
0,
szClassName,
"Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
456,258,
HWND_DESKTOP,
NULL,hThisIN,NULL);
ShowWindow(hwnd,cmdShow) ;
while(GetMessage(&messages,NULL,0,0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure(HWND hwnd,UINT message, WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
defult:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return 0;
}