CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2007
    Posts
    5

    Moving MFC CDialog

    Hi,

    My question is: what windows messages are sent to dialogs child controls when the user moves the dialog windowover the screen?

    I checked WM_MOVING, WN_MOVE, WM_SIZE handlers in child controls. Noneis called.
    OnPaint also is not called.

    Seems like the dialog just moves its bitmap.

    I am asking this question because I have a popup window over one of controls, like a tool tip (derived from CWnd). When the dialog is moving, the popup stays put. I need to keep popup relative position relative to the control the same all the time and I don't know how to do it.

    Any help is greatly appreciated.

  2. #2
    Join Date
    Jul 2010
    Posts
    3

    Re: Moving MFC CDialog

    Try to handle WM_MOVE for dialog window and send your message to child control

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Moving MFC CDialog

    Quote Originally Posted by geoyar View Post
    Hi,

    My question is: what windows messages are sent to dialogs child controls when the user moves the dialog windowover the screen?

    I checked WM_MOVING, WN_MOVE, WM_SIZE handlers in child controls. Noneis called.
    OnPaint also is not called.
    How did you check it? Using Spy++?
    What are you trying to achieve?
    Victor Nijegorodov

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Moving MFC CDialog

    There is no WM_MOVE, WM_SIZE, WM_MOVING or whatever message being send to your child controls when you just move the parent because the children are NOT moving relativly to the parent. Remember that child position is always relative to upper left corner of the parent.

    You also don't see WM_PAINT messages because you are probably running on Windows Vista or Windows 7 with desktop composition enabled which means that your window is basically just a texture on your video-card and when moving the video-card will simply translate that texture.

    What you should do is handle the WM_MOVE or WM_MOVING messages on the parent level and then use SetWindowPos to change the position of the popup.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Moving MFC CDialog

    I have a popup window over one of controls, like a tool tip (derived from CWnd). When the dialog is moving, the popup stays put.
    Think about making it a child rather than popup. Then dialog will move it as any other child.
    Best regards,
    Igor

Tags for this Thread

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