Solved

WM_MOVING in a not TitleBar window (How to)

Posted on 1998-09-23
3
459 Views
Last Modified: 2013-11-19
I have an MFC window without TitleBar. I want to handle WM_MOVE event in a given area. What can I do, when I catched that click? I tried to call CWnd::OnMoving(...) from there, but no.
Help please.
0
Comment
Question by:wau
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
danny_pav earned 50 total points
ID: 1322534
I am guessing you want to drag the window by clicking on some area and moving it as if you had clicked the title bar and moved it.

Then you should do this:
Override OnHitTest and tell the system that you are clicking in the title bar so that when clicked and moved, it will just do what it would for the title bar.


0
 

Author Comment

by:wau
ID: 1322535
I made like this:
UINT CMyDlg::OnNcHitTest(CPoint point)
{
      if( mouse_down ) //changed by WM_LBUTTONDOWN/UP
      {
            mouse_down=!mouse_down;
            return HTCAPTION;
      }
      else return CDialog::OnNcHitTest(point);
}
but no.
I tried also, calling this->SetCapture() and ::ReleaseCapture() every time mouse down/up occurs, but no.
Any of you have an idea what?
0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1322536
you don't need to test the mouse, just return HTCAPTION when the point is in the area you want


      UINT CMyDlg::OnNcHitTest(CPoint point)
      {
      CRect rc;
      get_click_drag_rect(rc);
      if (rc.PtInRect(point))
            return HTCAPTION;
      return CDialog::OnNcHitTest(point);
      }


0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question