Solved

WM_MOVING in a not TitleBar window (How to)

Posted on 1998-09-23
3
457 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CRON statement to run every 3 minutes except on Monday morning 12am to 2am 7 89
bigDiff challenge 17 84
lucky13 challenge 11 120
mapAB Challlenge 35 124
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now