I am creating a dialog without MFC and have run into yet another problem.
When I make my call to DialogBoxParam() to create and show the dialog, I
supply it with a function that will handle the messages from the dialog.
This has been working fine and things are coming along, until... I wanted to
catch mouse messages for my list view that is in the dialog. If I click
anywhere else in the dialog, I can catch the button down message, but if I
click in the list view area, the message is not sent to the function. Where
is it sent?

I can only supply one DLGPROC so I'm not sure what to do at this point.
Anyone have any ideas?

Thanks,
Steve

Re: catching messages for control in dialog by Igor

Igor
Wed Nov 23 12:28:27 CST 2005

Steve <sss@sss.com> wrote:
> I am creating a dialog without MFC and have run into yet another
> problem. When I make my call to DialogBoxParam() to create and show
> the dialog, I supply it with a function that will handle the messages
> from the dialog. This has been working fine and things are coming
> along, until... I wanted to catch mouse messages for my list view
> that is in the dialog. If I click anywhere else in the dialog, I can
> catch the button down message, but if I click in the list view area,
> the message is not sent to the function. Where is it sent?

To the list view control of course. It's a window in its own right, with
its own window proc.

You can handle NM_CLICK notification (sent in the form of WM_NOTIFY
message). The control sends this and other notifications to its parent
window - in this case, your dialog.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: catching messages for control in dialog by Doug

Doug
Wed Nov 23 12:31:24 CST 2005

On Wed, 23 Nov 2005 10:11:48 -0800, "Steve" <sss@sss.com> wrote:

>I am creating a dialog without MFC and have run into yet another problem.
>When I make my call to DialogBoxParam() to create and show the dialog, I
>supply it with a function that will handle the messages from the dialog.
>This has been working fine and things are coming along, until... I wanted to
>catch mouse messages for my list view that is in the dialog. If I click
>anywhere else in the dialog, I can catch the button down message, but if I
>click in the list view area, the message is not sent to the function. Where
>is it sent?
>
>I can only supply one DLGPROC so I'm not sure what to do at this point.
>Anyone have any ideas?

The message is posted to the listview control. To intercept it, you'll have
to subclass the control by replacing its WNDPROC. See here for explanation
and links to documentation:

Safer subclassing
http://blogs.msdn.com/oldnewthing/archive/2003/11/11/55653.aspx

--
Doug Harrison
Visual C++ MVP