|
-
April 30th, 1999, 01:51 AM
#1
Non Client Messages
Hi,
I developed a small application where I converted the client mouse messages to non-client mouse messages. Here is how I did it :
void CMoveWinView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_fDragging=TRUE;
AfxGetMainWnd()->SendMessage(WM_NCLBUTTONDOWN,HTCAPTION,0);
CView::OnLButtonDown(nFlags, point);
}
void CMoveWinView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_fDragging)
AfxGetMainWnd()->SendMessage(WM_NCMOUSEMOVE,HTCAPTION,0);
CView::OnMouseMove(nFlags, point);
}
void CMoveWinView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_fDragging=FALSE;
AfxGetMainWnd()->SendMessage(WM_NCLBUTTONUP,HTCAPTION,0);
CView::OnLButtonUp(nFlags, point);
}
The problem is that it worked fine !!!
I passed the mouse co-ordinates as 0 in SendMessage but still the frame window is moved correctly when we drag in client area!!
Any of the brainy code gurus out there .... please explain!!
Vishal
-
April 30th, 1999, 03:38 AM
#2
Re: Non Client Messages
The answer is there is not some intelligent code generated.When you send the WM_NCLBUTTONDOWN to
the main window,the window capture the mouse,so the mouse messages are all sended to the main window until the mouse button is up,that is,your
view's OnMouseMove and OnLButtonUp is not executed
at all.I think this is the answer,your idea?
-
April 30th, 1999, 05:18 AM
#3
But what about mouse co-ordinates
Thanx for the answer, it helped but I have a doubt, rather another question :
How does the Frame window handle mouse co-ordinates. When the mouse is in the client area how does the frame window treat it relative to the caption bar ?
Vishal
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|