WNDPROC 声明问题,从 C 转换为 C++
我正在将程序从 C 转换为 C++。我将编译器设置为默认使用 __fastcall 调用约定。
我曾经有一个声明行如下:
INT32 PASCAL graph_window_handler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
后来我有:
wndclass.lpfnWndProc = graph_window_handler;
这一切都在 C 下编译和工作。但是在 C++ 下,我收到编译器关于第二行代码的各种抱怨。我想我需要将原始声明更改为涉及 WNDPROC 的内容,也许添加 _cdecl ?有或没有 INT32?但似乎我尝试的每一个变化仍然会受到抱怨。声明应该是什么样子,这样第二行就不会被抱怨? - 干杯。
I am converting a program from C to C++. I have the compiler set to use the __fastcall calling convention by default.
I used to have a declaration line as follows:
INT32 PASCAL graph_window_handler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Later I have:
wndclass.lpfnWndProc = graph_window_handler;
This all compiled and worked under C. But under C++ I get all sorts of complaints form the compiler about the second line of code. I guess I need to change the original declaration to something involving WNDPROC, perhaps with a _cdecl thrown in? With or without the INT32? but it seems that every variation I try still gets complained about. What should the declaration look like such that the second line does not get complained about? - cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 MSDN 文档,它应该看起来像 :
如果您检查
WinUser.h
,您会看到WNDPROC
typedef'ed 如下According to MSDN documentation it should look like the following:
And if you'll check
WinUser.h
you'll see thatWNDPROC
typedef'ed as follows: