Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dialog-box child window that accepts WM_NCHITTEST and WM_LBUTTONDOWN

343 views
Skip to first unread message

Rhett

unread,
Aug 13, 2002, 9:37:29 AM8/13/02
to
Hi all.


In brief:

How do you make a child window in a dialog-box
that holds a picture and can signal cursor entry and
mouse-clicks?


In full:

I am making a filter plug-in for Adobe Photoshop,
and use VC++ without MFC (because it must also
be compiled on an Apple platform) and the Adobe
Photoshop 6.0 SDK.

The plug-in is a dialog-box window created with
DialogBoxParam.

In this dialog-box I want to make a child window
that displays the image. I could use the 'Static'
system class. If I then define my own window
procedure for this static control (with SetWindowLong
and GWL_WNDPROC) I can catch the
WM_NCHITTEST but not WM_LBUTTONDOWN).
If I instead use the dialog-box's own window procedure,
I can let the static control notify the parent window with a
STN_CLICKED message, but I do not get
WM_NCHITTEST messages when the cursor is over
the static control window.

Yes, I know that it is possible to simply paint on a
section of the dialog-box itself, but that means I
have to make special code that checks if I move and
click within the image area, which I think is inefficient
and messy (handling the WM_NCHITTEST and
WM_LBUTTONDOWN in the dialog-box's own
window procedure).

Have I missed something here?

Can I use a different system class than Static?

Can I make a custom control window that acts as
a child window in the dialog-box, that simply holds
the image (no border/top/menus) and accepts
WM_NCHITTEST and WM_LBUTTONDOWN?
How then register it and create it? (I have never made
my own custom control before).


Thanks.


Jim McPherson

unread,
Aug 14, 2002, 11:44:06 PM8/14/02
to
Rhett,

A static control seems appropriate for the purpose
you mention. Your quandary likely arises from the
fact that they have no non-client area to hit test (doh!).

But since you did not say, I'll guess that the reason
you want to see WM_NCHITTEST is to enable dragging
of the dialog by the static control client area. If this is
indeed what you wish, you should be able to do so
by catching left button down over the static control,
and sending the parent a WM_NCLBUTTONDOWN
with the HTCAPTION hit code.

Rhett

unread,
Aug 15, 2002, 1:03:28 PM8/15/02
to
Thanks Jim.

a) I want to change the cursor to the Photoshop 'move-hand'
whenever I am over the image area (the 'proxy window' or
the static control window with the painted image).

b) I want to be able to drag the proxy image by holding down the
mouse button whenever I am in the proxy window.

The STATIC window class is, by its nature, not suited for
such interaction. It does not receive WM_LBUTTONDOWN
or WM_MOUSEMOVE messages.

If the static control has the SS_NOTIFY style it will send a
STN_CLICKED message to its parent (the dialog box)
through a WM_COMMAND message.

For some reason the STN_CLICKED is NOT sent if
the static control gets its own window procedure, set with a
call like:

SetWindowLong( GetDlgItem(hDlg, kDProxyItem),
GWL_WNDPROC, (LONG) ProxyWndProc );

But i am convinced that a static control is not made for mouse
input. My simple question then is: What control can I use that
acts like a child window in a dialog box and can receive
WM_NCHITTEST, WM_LBUTTONDOWN and
WM_MOUSEMOVE messages?

By the way, I did try WM_NCLBUTTONDOWN, but in the
parent window procedure no such message is received from the
system, and how can I SEND such a message from the proxy
window procedure if mouse input is not received there?

Thanks for the help anyway.

Rhett

0 new messages