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

Mouse click event in window caption/title?

1,071 views
Skip to first unread message

Charles Ginzel

unread,
Oct 16, 2000, 3:00:00 AM10/16/00
to
Can anyone tell me which "pbm_" events I should use if I want to detect the
left mouse button down and up within a window's title bar (e.g. when you
click on the header to move a window)?

Thanks,
-Charles

Jean-Paul Finne

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to
An excellent tool to find this kind of information is spy++ from Microsoft.
It gaves me the following messages:
wm_ncmousemove
wm_nchittest
wm_setcursor
wm_ncactivate
wm_activate
wm_syscommand
wm_capturechanged
wm_getminmaxinfo
wm_entersizemove
wm_mousemove
wm_moving
wm_windowposchanging
wm_ncpaint
wm_windowposchanged
wm_existsizemove
...


"Charles Ginzel" <cgi...@usa.net> wrote in message
news:NXCgi4#NAHA...@forums.sybase.com...

Peter Szintai

unread,
Oct 18, 2000, 3:00:00 AM10/18/00
to
Hi Charles:

Create a new event on the window (e.g. ue_syscommand), the Event ID is:
pbm_syscommand.

Check the message.wordparm, if it is 61456 or 61458, then the user clicked on
the title.

#define SC_SIZE 0xF000
#define SC_MOVE 0xF010 <==
#define SC_MINIMIZE 0xF020
#define SC_MAXIMIZE 0xF030
#define SC_NEXTWINDOW 0xF040
#define SC_PREVWINDOW 0xF050
#define SC_CLOSE 0xF060
#define SC_VSCROLL 0xF070
#define SC_HSCROLL 0xF080
#define SC_MOUSEMENU 0xF090
#define SC_KEYMENU 0xF100
#define SC_ARRANGE 0xF110
#define SC_RESTORE 0xF120
#define SC_TASKLIST 0xF130
#define SC_SCREENSAVE 0xF140
#define SC_HOTKEY 0xF150
#if(WINVER >= 0x0400)
#define SC_DEFAULT 0xF160
#define SC_MONITORPOWER 0xF170
#define SC_CONTEXTHELP 0xF180
#define SC_SEPARATOR 0xF00F
#endif /* WINVER >= 0x0400 */

Bye: Peter Szintai

Charles Ginzel

unread,
Oct 18, 2000, 3:00:00 AM10/18/00
to Peter Szintai
Peter,

When I check the message.wordparm within the pbm_syscommand, only the 61458 comes
through on the click. Which is basically what you said. But I really need to
register both the mouse down and the mouse up during a click on the title. This
really only provides a mouse down event...

-Charles

Philip Salgannik

unread,
Oct 19, 2000, 3:00:00 AM10/19/00
to
Charles, can you elaborate on what exactly you are trying to do?


pbm_thisusuallydoesnothelp:-))

Philip Salgannik


"Charles Ginzel" <cgi...@entergy.com> wrote in message
news:39EE2CA6...@entergy.com...

Nick Stamos

unread,
Oct 20, 2000, 3:00:00 AM10/20/00
to
A reasonable approach is to track the pbm_nchittest, pbm_nclbuttondown, etc.
These are the same events (except for pbm_nchittest) for the client area of
a window, but refer to captions, borders etc. In some cases you might
consider using the SetCapture()/ReleaseCapture() API calls...

CBC
Nick Stamos
nst...@hotmail.com


Ο "Charles Ginzel" <cgi...@usa.net> έγραψε στο μήνυμα
news:NXCgi4#NAHA...@forums.sybase.com...

Peter Szintai

unread,
Oct 20, 2000, 3:00:00 AM10/20/00
to
Hi Nick!

AFAIK:
1. There is only one correct event, when the user clicks on the title:
pbm_syscommand / SC_MOVE
2a. If the code rejects this event:
message.processed = true
message.returnvalue = 0,
the window will get a pbm_nclbuttonup event (Thanx for the idea :)
2b. otherwise, if the user moved the window, the window
will get a pbm_move event (there is not pbm_nclbuttonup)
2c. Click on the window title (and the code accepts the event) without moving
the window: I have not idea...

Please, correct me, if I make a mistake: Peter Szintai.

Nick Stamos

unread,
Oct 20, 2000, 3:00:00 AM10/20/00
to
Sorry Peter,

as I already stated the correct event to track mouse action in a window's
non client region is pbm_nchittest()...
On the other hand, pbm_syscommand() maps to WM_SYSCOMMAND:
"A window receives this message when the user chooses a command from the
window menu (also known as the System menu or Control menu) or when the user
chooses the Maximize button or Minimize button." (Windows API reference)

CBC
Nick Stamos
nst...@hotmail.com


? "Peter Szintai" <szp...@vtsoft.hu> ?????? ??? ??????
news:39F0242B...@vtsoft.hu...

Peter Szintai

unread,
Oct 20, 2000, 3:00:00 AM10/20/00
to
Hi Nick:

1. The System menu, the Maximize and Minimize buttons are on the title.
2. The wm_nchittest, and the wm_nclbutton... events look good, but:
If the window has menu, the window is maximized, and you moves your mouse up to
the title,
the window will get a wm_nchittest event at the bottom of the menu (it is not
the part of the client region). And, as the API reference says:

"The WM_NCHITTEST message is sent to a window when the cursor moves, or when a
mouse button is pressed or released. ..."

You dont get the state of the mouse button. The x and y position parameters are
relatives to the upper-left corner of the screen.

The hittestcode param of the pbm_lbuttondown and pbm_lbuttonup (wparam (hit-test
value) in the wm_...) says the location,
HT_CAPTION is the title bar. But, as I wrote, if the user can move the window,
it will not get pbm_nclbuttonup event, only a
pbm_move (together with a pbm_nchittest).

When I say: the pbm_syscommand / SC_MOVE is the only correct event for the
click on the title, it means: you have not check other parameters,
the mouse is on the title, and the left mouse button is pressed...

Peter Szintai
szp...@vtsoft.hu

0 new messages