“WindowProc"的正确返回值在 Win32 应用程序中 [英] Correct return value of "WindowProc" in a Win32 application

查看:15
本文介绍了“WindowProc"的正确返回值在 Win32 应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MSDN 的 Win32-Api 文档中(位于 http://msdn.microsoft.com/en-us/library/ms633573%28VS.85%29.aspx) 在 WindowProc 上,它指出:返回值是消息处理的结果,取决于发送的消息.

In MSDN's Win32-Api documentation (at http://msdn.microsoft.com/en-us/library/ms633573%28VS.85%29.aspx) on the WindowProc, it states: The return value is the result of the message processing and depends on the message sent.

由于我必须实现这个(回调)过程,我想知道它依赖什么,我必须返回什么.有人可以对此有所了解吗?

Since I have to implement this (callback) procedure, I'd like to know what it depends on, and what I have to return. Can someone shed some light on this?

推荐答案

这取决于您正在处理的确切消息.您需要参考该消息的文档以查看返回值的预期值和含义.

It is dependent on the exact message you are processing. You need to refer to the documentation for that message to see the expected values and meanings of the return value.

例如,对于 WM_CREATE,您应返回零以继续创建窗口,并返回 -1 以失败并销毁窗口.对于 WM_GETICON,您应该返回一个句柄到您窗口的图标.

For instance, for WM_CREATE, you should return zero to continue window creation, and -1 to fail and destroy the window. For WM_GETICON, you should return a handle to the icon for your window.

对于您没有明确处理的消息,您应该调用 DefWindowProc,将所有参数传递给窗口过程,并将其返回值返回给调用者.

For messages that you do not explictly handle, you should call DefWindowProc, passing to it all the parameters to your window proc, and return its return value to the caller.

这篇关于“WindowProc"的正确返回值在 Win32 应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆