- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在学习使用 DirectX9 创建游戏,我发现了 define WinProc 的不同版本:
LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
我不知道它们之间有什么不同,我应该使用哪个版本?谢谢兄弟。
最佳答案
#define CALLBACK __stdcall
#define WINAPI __stdcall
从两者的宏观定义来看,它们是一样的。
MSDN :
CALLBACK, WINAPI, and APIENTRY are all used to define functionswith the __stdcall calling convention. Most functions in the WindowsAPI are declared using WINAPI. You may wish to use CALLBACK forthe callback functions that you implement to help identify thefunction as a callback function.
什么是 Windows 调用约定?
来自 MSDN :
The way the name is decorated depends on the language and how thecompiler is instructed to make the function available, that is, thecalling convention. The standard inter-process calling convention forWindows used by DLLs is known as the WinAPI convention. It is definedin Windows header files as WINAPI, which is in turn defined using theWin32 declarator __stdcall.
也就是说WINAPI、CALLBACK和_stdcall在Windows平台上是一样的。
您可以使用 CALLBACK 或 WINAPI。
关于c++ - "LRESULT CALLBACK WinProc"和 "LRESULT WINAPI WinProc"之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57231201/
我正在学习使用 DirectX9 创建游戏,我发现了 define WinProc 的不同版本: LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM
我注意到 WinAPI 中的某些消息只能在使用 PeekMessage() 的“主消息循环”中检索(如 WM_QUIT),其他消息只能在用户定义的 winProc() 函数(如 WM_CLOSE 和
我已经像这样定义了一个 winproc 消息处理程序 WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 是否有将 uMsg 代码转
在某些时候,我有这个 LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if(msg=
我正在尝试使用 C++11 来解决我最喜欢的指针问题 LRESULT CALLBACK renderMan::WindowProc(HWND hWnd, UINT msg, WPARAM wParam
我需要将字符串从 C# 发送到 C++ WindowProc。 SO 上有许多与此相关的相关问题,但没有一个答案对我有用。情况是这样的: PInvoke: [DllImport("user32", C
我正在创建一个新的 Windows C# 窗体应用程序,它使用各种硬件系统(Kinect V2 和 3D RFID 定位系统)。这是一个科学应用程序,而不是游戏,但具有绝对类似于游戏的逻辑(需要收集和
我收到错误消息,同时我正在努力使这项工作正常进行,因此请阅读我要说的内容。谢谢.... 我正在创建一个 C++ 应用程序,该应用程序的大部分都封装在一个类中。这意味着我的 WinProc 函数是一个静
所以我遇到了堆问题,想知道它是否与我处理某些数组的方式有关。实际上,在某些时候我有一些像这样的消息发送到我的 WinProc: SendMessage(hwnd, LOG_ADD, NULL, (LP
我是一名优秀的程序员,十分优秀!