I’ve been looking over the tutorial here:
http://msdn.microsoft.com/en-us/library/bb384843.aspx, but I’m really confused on one point.
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
I have no idea what they’re doing with return there. I know return only works with one value. Why are there 2 things? I’ve looked at other tutorials and they all seem to use return msg.wParam;
It is casting the value of
msg.wParamto an int. As you can see in the function declaration:the return type is
int. I don’t know exactly what the type of the propertywParamis, but it is probably not anint, so it has to be explicitly cast to an int or it would not compile.