Jens
Jens

Reputation: 25593

Reliably identifying any window's client area

I am working on a program that will replicate, and then extend the functionality of Aero Snap.

Aero Snap restores a maximized window, if the user "grabs" it's title bar, and I am having difficulties identifying this action.

Given a cursor position in screen coordinates, how would I check if the position is within the window's title bar? I am not really at home in the Win32 API, and could not find a way that works reliably for complicated scenarios such as:

example for a difficult title bar

Note that tabs that chrome inserts into the title bar. Office does something similar with the quick launch menu.

Upvotes: 0

Views: 254

Answers (1)

gbjbaanb
gbjbaanb

Reputation: 52689

title bar hits are via the message "non client" messages - ie the area of a window that is not the client (or inner) window.

WM_NCLBUTTONDOWN is probably the message you want to trap.

You also probably want to set a window hook to hook mouse messages, if its the NC message you want, you handle it your way, if not - pass it on to the message chain.

Edit: if Chrome is using the DwmExtendFrameIntoClientArea calls to draw the tabs, then you will need to use WM_NCHITTEST.

Upvotes: 1

Related Questions