OnNcLButtonUp() not called

I have an object that I allow the user to drag around. I've created it as a CWnd, and I've overridden OnNcHitTest() to always return HTCAPTION. That makes the drag work fine. But I also want to get mouse down and up messages. OnNcLButtonDown() works exactly as I expect, but when I release the mouse, I never get OnNcLButtonUp(). I do get it if I double-click. I also never get OnLButtonDown/Up either (which seems ok, since I'm telling the hit test function that it's always a non-client click). I see this same problem discussed in the Windows newsgroups, but I don't see any helpful answers there.
[625 byte] By [Bore] at [2007-11-17 0:01:04]
# 1 Re: OnNcLButtonUp() not called
I noticed the same problem, well I guess the true reason is a bug? I used Borland's winsight32 to trace all the messages going in the window, there was no WM_NCLBUTTONUP if you click only once!

I figured out a solution to your problem, you can handle WM_MOVE message to do the same job, after all, WM_MOVE is sent directly after you release the mouse button, code is somehow like this:

void CWnd::OnNcLButtonDown(...)
{
LMouseDown = TURE;
...
}

void CWnd:OnMove(...)
{
if(LMouseDown){
LMouseDown = FALSE;
// your code here
}
}
masterjy at 2007-11-10 6:40:56 >
# 2 Re: OnNcLButtonUp() not called
You said, "WM_MOVE is sent directly after you release the mouse button." I do not observe this behavior. I see WM_MOVE when I move the window, but if I stop moving the window and release the mouse button, I do not get a final WM_MOVE message, which is what I need. Thanks for trying.
Bore at 2007-11-10 6:41:57 >
# 3 Re: OnNcLButtonUp() not called
Well, WM_MOVE will definitely do the job, what you observed should be WM_MOVING which is generated all the time when you are moving the window.
masterjy at 2007-11-10 6:42:55 >
# 4 Re: OnNcLButtonUp() not called
No, that is not what I observed. I used Class Wizard to generate OnNcLButtonDown(), OnNcLButtonUp(), OnMove() and OnMoving(). Here is exactly what I observed: if I click and quickly let go, I see only the button down. If I click and hold for a second, then let go, I see the button down, followed by OnMoving() while the button is still down, and one more OnMoving() when the button is released. If I drag the object, I see multiple OnMove() and multiple OnMoving(), and finally when I release the mouse I see one more OnMoving(). If you don't believe me, code it yourself. Please don't try to tell me what I observed or what I should have observed. I asked the question because I wanted help, not because I wanted you to tell me what I should have observed.
Bore at 2007-11-10 6:43:59 >
# 5 Re: OnNcLButtonUp() not called
hi Bore, the method worked fine with me, I watched all the mouse messages and there was only one WM_MOVE, could you send the actual code?
masterjy at 2007-11-10 6:44:58 >
# 6 Re: OnNcLButtonUp() not called
I will send the code if you will tell me how to send it. I don't see an email address for you.
Bore at 2007-11-10 6:46:07 >
# 7 Re: OnNcLButtonUp() not called
please send to sayer_jim@hotmail.com.
masterjy at 2007-11-10 6:47:00 >