In《Programint Windows》chapter 5 code:DEVCAPS1.C,there are
"return msg.wParam;" but not "return 0;" which we are familiar with; Is "return 0" different from "return msg,wParam"?
search MSDN:
GetMessage():
Return Value
If the function retrieves a message other than WM_QUIT, the return value is nonzero.
If the function retrieves the WM_QUIT message, the return value is zero.
so when out of while ,the function GetMessage gets the msg WM_QUIT;
search WM_QUIT:
this msg has two Parameters
wParam
Specifies the exit code given in the PostQuitMessage function.
lParam
This parameter is not used.
here we know here wParam is assigned by the parameter which PostQuitMessage passed;
then I return <<Programing Windows >>:
case WM_DESTROY: PostQuitMessage (0) ; return 0 ;
you see here PostQuitMessage 's parameter is 0
In a word here at this code return 0 and return msg.wParam is the same. Do you agree?
本文探讨了Windows编程中WM_QUIT消息的作用及GetMessage函数的返回值。详细解释了PostQuitMessage与return 0及return msg.wParam之间的联系,揭示了WM_QUIT消息参数wParam的含义。
314

被折叠的 条评论
为什么被折叠?



