winmain() 函数 / c++
您能向我解释一下通常写在 WinMain()
函数末尾的这条语句的意义吗:
return (int) msg.wParam;
我习惯用 return 0;
结束我的控制台应用程序,是吗? Windows 应用程序错误吗?
谢谢。
can you please explain to me the significance of this statement generally written at the end of the WinMain()
function:
return (int) msg.wParam;
Im used to ending my console applications with return 0;
is it wrong for windows applications?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GetMessage()
循环在收到WM_QUIT
< /a> 窗口消息,通常在调用PostQuitMessage()
函数,它将其nExitCode
参数描述为应用程序退出代码。如果您想尊重调用 PostQuitMessage() 函数的人的意图,您应该从 main.c 中返回该值。这就是您在返回从上次调用
GetMessage()
中检索到的wParam
时所做的事情。The
GetMessage()
loop stops after receiving aWM_QUIT
window message which is normally issued after a call to thePostQuitMessage()
function, which describes itsnExitCode
parameter as the application exit code.If you want to respect the intent of the person who invoked the
PostQuitMessage()
function, you should return that value from main. This is what you are doing when you return thewParam
retrieved from the last invocation ofGetMessage()
.来自
WinMain()
文档 (http ://msdn.microsoft.com/en-us/library/windows/desktop/ms633559.aspx):From the
WinMain()
docs (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633559.aspx):来自 Google 的第一次点击搜索
From the first hit of a Google search