The meaning of the return value varies from message to message and for
many messages the return value is ignored. Your Windows documentation
will tell you any particular message should return a meaningfull value.
The value returned from the WM_MOUSEMOVE message is ignored and the
documentation states that you _should_ return 0 from WM_PAINT so I am
hardly surprised that your mouse still works and that your window is
visible.
Norm
>Ashod wrote:
>>
>> Just a quick question.
>>
>> If I process a windows message in my WndProc what do I return
>> back to windows.. is it 0L ?. Does returning different values
>> do different things..
Here's something fun: return -1 on WM_CREATE.
You need to look at each message you use to ensure that you
are returning the correct value - it tells you exactly what to return.
In most cases, you return 0 if you process the message, otherwise
you pass it on to DefWindowProc() for default processing. WM_CREATE
is a special case (-1 if you want to make it fail) and there are
others. Consult the documentation for all WM_ messages
when you write your WndProc.
I abhor functions with multiple returns. All of my functions have a
single exit point. For WndProc, I find the following syntax to be
functional and clear:
LRESULT CALLBACK WndProc(HWND hwnd,UINT wm,
WPARAM wp,LPARAM lp)
{
bool handled=true;
switch(wm){
case WM_XXX:
break;
case WM_YYY:
break;
case WM_ZZZ:
break;
default: handled=false;
break;
}
return(handled ? 0 : DefWindowProc(hwnd,wm,wp,lp));
}
It is clear that if the message is 'handled', you return 0,
otherwise you return whatever result DefWindowProc()
returns when the default message handling occurs.
For a DlgProc(), the method is similar, but since it returns
a BOOL to indicated whether it was handled or not, you
would just do:
return(handled);
--
John A. Grant * I speak only for myself * (remove all 'z' to
reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here.