作业帮 > 综合 > 作业

#includeLRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);//

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/23 19:57:42
#include
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);//windpws main' diclare
//以下初始化窗口类
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR IpszCmdLine,int nCmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
char IpszClassName[]="窗口";
char IpszTitle[]="My_Windows";
//窗口类定义
wndclass.style=0;
wndclass.IpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.IpszMenuName=NULL;
wndclass.IpszClassName=IpszClassName;
//以下进行窗口类的注册
if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return FALSH;
}
//创建窗口
hwnd=CreateWindow(IpszClassName,IpszTitle,WS_OVERLAPPEDEWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
//窗口函数
LURESULT CALLBACK Wndproc(HWND hwnd,UINT message,WPARAM wParam,LPARAM Iparam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
default:
return DefWindowProc(hwnd,message,wParam,IParam);
}
return (0);
}
这个程序杂出现了八个错误呀,我怎么也找不出错在那,
下面这位老兄的回答很不错,在编译时零个错误,但是运行时却出现了两错误,难道是编译器的问题吗?搞不懂!
那位老兄能帮解决一下,还有我想是不是下面这为老兄只考虑到编译,而忽略了程序运行时错误,
#includeLRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);//
#include
LRESULT CALLBACK Wndproc(HWND,UINT,WPARAM,LPARAM);//windpws main' diclare
//以下初始化窗口类
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR IpszCmdLine,int nCmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcex;
char IpszClassName[]="窗口";
char IpszTitle[]="My_Windows";
//窗口类定义
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)Wndproc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance,IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL,IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName =IpszClassName;
wcex.hIconSm = LoadIcon(wcex.hInstance,IDI_HAND);
//以下进行窗口类的注册
if(!RegisterClassEx(&wcex))
{
MessageBeep(0);
return FALSE;
}
//创建窗口
hwnd=CreateWindow(IpszClassName,IpszTitle,WS_OVERLAPPEDWINDOW ,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//窗口函数
LRESULT CALLBACK Wndproc(HWND hwnd,UINT message,WPARAM wParam,LPARAM Iparam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,Iparam);
}
return 0;
}