vc++6.0 编译连接OK,运行报错,哪位大虾米看看
//vc++6.0 编译连接OK,运行报错,哪位大虾米看看 #include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WinExample1Proc(HWND hwnd,UINT uMsg, WPARAM wParam,LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WinExample1Proc;
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&wndcls);
HWND hwnd;
hwnd=CreateWindow("example1","一个WIN窗口",WS_OVERLAPPEDWINDOW,0,0,500,500,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_NORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WinExample1Proc(HWND hwnd,UINT uMsg, WPARAM wParam,LPARAM lParam)
{
char exChar2[]={"第一个WIN程序"};
switch(uMsg)
{
case WM_CHAR:
char exChar1[40];
sprintf(exChar1,"ASCII值为:%d",wParam);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}