views:

42

answers:

1

I'm coding a custom background non rectangular window with buttons such as minimize and close in bitmaps. Here is my code just for now The problem is the custom window does not receive mouse messages while hovering over non zero alpha regions.

A: 

Since minimize and close buttons are outside window client area, you need to capture WM_NCLBUTTONUP in addition to WM_LBUTTONUP

mmonem
I see. Since I'm almost always returning HTCAPTION in WM_NCHITTEST, I need to process non-client mouse messages. But I'm now having problem with WM_NCLBUTTONUP - it's triggered only after double click on the window. Is it OS specific? I have Win XP SP3. I saw a solution for this problem involving SetWindowsHook for mouse messages, but it's rather ugly.
vian
There is a difference between WM_NCLBUTTONUP and WM_LBUTTONUP. From MSDN**WM_LBUTTONUP**: *If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.***WM_NCLBUTTONUP**:*If a window has captured the mouse, this message is not posted.*
mmonem