Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WM_MOVING in a not TitleBar window (How to)

Posted on 1998-09-23
3
Medium Priority
?
465 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 100 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

705 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