Solved

WM_MOVING in a not TitleBar window (How to)

Posted on 1998-09-23
3
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

739 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