各位大侠帮我我看下下面C++代码哪里是错误的,谢谢!

#include<windows.h>#include<WINBASE.H>voidmain(){typedefstruct_WNDCLASS{UINTstyle;WND... #include <windows.h>
#include <WINBASE.H>
void main()
{
typedef struct _WNDCLASS {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS, *PWNDCLASS;
HMODULE MKM;
WNDCLASS windows;
MKM=GetModuleHandle(0);
windows.style=0;
windows.lpfnWndProc=WndProc;
//定义函数指针
long CALLBACK WndProc(
WNDPROC lpPrevWndFunc, // pointer to previous procedure
HWND hWnd, // handle to window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
调试返回的结果为:
Compiling...
main1.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\main1\main1.cpp(21) : error C2065: 'WndProc' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\MyProjects\main1\main1.cpp(21) : error C2440: '=' : cannot convert from 'int' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
D:\Program Files\Microsoft Visual Studio\MyProjects\main1\main1.cpp(31) : error C2373: 'WndProc' : redefinition; different type modifiers
D:\Program Files\Microsoft Visual Studio\MyProjects\main1\main1.cpp(31) : error C2601: 'WndProc' : local function definitions are illegal
Error executing cl.exe.
main1.exe - 4 error(s), 0 warning(s)

)
{
return DefWindowProc(hwnd,message,wParam,lParam);
}
}
展开
 我来答
kingfeng588
2013-02-25 · TA获得超过2494个赞
知道大有可为答主
回答量:1475
采纳率:50%
帮助的人:1934万
展开全部
修改后:

#include <windows.h>
#include <WINBASE.H>

long CALLBACK WndProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);

void main()
{
HMODULE MKM;
WNDCLASS windows;
MKM=GetModuleHandle(0);
windows.style=0;
windows.lpfnWndProc=WndProc;
}

//定义函数指针
long CALLBACK WndProc(
HWND hWnd, // handle to window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
return DefWindowProc(hWnd,Msg,wParam,lParam);
}
匿名用户
2013-02-25
展开全部
你写的?你的复制时是不是复制错了,怎么看起来莫名其妙的?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式