Tech Support > Microsoft Windows > Development Resources > sendmessage to dialog box unreliable return value
sendmessage to dialog box unreliable return value
Posted by Martijn on October 10th, 2003


Hi,

When I send a message to my dialog box, I have no way of telling whether it
actually processed it or not, because regardless of what it the dialog
procedure returns, it always returns 0 (for this particular message, which
happens to be a WM_COMMAND message with the id of a specific control). The
dialog box is a child of the window sending this message.

How do I go about being able to tell whether my dialog proc returned FALSE
or TRUE? Only option I can come up with now, is either a) doing something
with it in the message loop, or b) having the dialog window send a message
BACK to the parent, but this brings along some extra overhead and is really
regarded as a last resort.

Thanks for any help,

--
Martijn
http://www.sereneconcepts.nl


Posted by Raymond Chen on October 11th, 2003


Don't forget that the return value from a dialog procedure does
NOT set the return value for the message. It merely indicates
whether the message was handled. If you want to handle the
message AND return a value, use SetWindowLong(hdlg,
DWL_MSGRESULT, returnValue).

Posted by Martijn on October 13th, 2003


Raymond Chen wrote:
Thanks, that is exactly what I was looking for!

--
Martijn
http://www.sereneconcepts.nl




Similar Posts