Mostly you return 0 to signal "I have handled this message" and 1 to indicate that the default windows process should handle the message (further).
If you are not processing a message, you need to pass it along by calling DefWindowProc() which will take the appropriate action, which is most often to simply delete the message from the queue, but not always.
However; you need to check the documentation for each message to know what the return value means... Sometimes it's nothing, sometimes it's a constant, a brush or a struct.
Here's a snippet of code...
Keep in mind this is a very simple MsgProc....
Code:
// Message Loop
LRESULT CALLBACK MsgProc(HWND wnd,UINT msg,WPARAM wparm,LPARAM lparm)
{ switch (msg)
{ // main window buttons
case WM_COMMAND :
switch(LOWORD(wparm))
{ case 100 : // pick a start path
SelectFolder();
return 0;
case 110 : // toggle recursion
SetRecurse();
return 0;
case 120 : // kill a scan
StopScan();
return 0;
case 130 : // launch a scan
DoScan();
return 0;
case 140 : // write report file
SaveReport();
return 0;
case 150 : // show the help file
ShowHelp();
return 0;
case 160 : // give up and go home
SendMessage(WHandle[0],WM_CLOSE,0,0);
return 0;
case 170 : // Launch from pulldown
HandlePulldown( HIWORD(wparm) );
return 0;
default :
return DefWindowProc(wnd,msg,wparm,lparm); }
// User messages
case UM_FINISH :
CompleteTest();
return 0;
case UM_ADDERR :
AddError(wparm,(PCHAR)lparm);
return 0;
case WM_TIMER :
case UM_UPDATE :
UpdateStatusBar(wparm);
return 0;
// misc. messages
case WM_CTLCOLORSTATIC :
return SetColors((HDC)wparm,(HWND)lparm);
case WM_SIZE :
ResizeWindow();
return 0;
case WM_GETMINMAXINFO :
SetWindowMin((PMINMAXINFO) lparm);
return 0;
case WM_CLOSE :
StopScan();
SaveSettings();
DestroyWindow(WHandle[0]);
return 0;
case WM_DESTROY :
PostQuitMessage(0);
return 0;
default :
return DefWindowProc(wnd,msg,wparm,lparm); } }