CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    8

    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


  2. #2
    Join Date
    Apr 1999
    Posts
    16

    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?


  3. #3
    Join Date
    May 1999
    Posts
    8

    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
  •  





Click Here to Expand Forum to Full Width

Featured