CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Posts
    91

    How to move two windows simultaneously...

    Hi,

    I have two toplevel windows, one is placed directly over the other one and they are both the same width and hight and position. When the top window is moved I need to move the bottom window simultaneously. I have tried handing the WM_MOVING event of the top window and then placing code in that event to move the bottom window.

    This works, but it is not smooth. I need both windows to have their position change at the exact same time so that it is seamless!!

    How can I do this?
    Is there a way? could someone post an example?

    P.S Adding one window as a child window is absolutely not an option for me. Just so you know.

    Thanks,
    Greg

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to move two windows simultaneously...

    The only way I can think of is to handle the WM_MOVE message in the top window; and post the same message to the bottom window. I wouldn't expect this to be really smooth, though.

    Oh, another option is to hide the bottom window, and move it once the top is done moving...

    Viggy

  3. #3
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: How to move two windows simultaneously...

    Is your top top-level window partially transparent?
    If yes - you are out of luck.
    If no - as MrViggy suggested, hide the bottom window. Actually, don't even show it later - it is not visible anyway.

    Did you look at DeferWindowPos?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  4. #4
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: How to move two windows simultaneously...

    I do not know what kind of windows you are moving therefore I have used dialogs in attached sample.
    See if moving is smooth enough.
    Attached Files Attached Files
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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