Thread: Resizing and moving windows

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    65

    Resizing and moving windows

    Hi, I want to write a C++ program to resize and move windows that are already open. This means I need to get a list of current windows. Can someone point me to relevant documentation on this subject? I have just started developing for Windows. Btw I'm using Windows 7.

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    To get the handles of windows that are just children of the desktop (parent windows), then you can use EnumWindows (EnumWindows Function (Windows)).

    If you want the handles of all windows, including descendant windows of the desktop, then you can use GetWindow in a loop or recursive function (GetWindow Function (Windows)).

    Another way to do it, which is very useful for testing, is WindowFromPoint. You can test for mouse clicks and use the coordinates to get you the handle of a window. (WindowFromPoint Function (Windows))

    Once you have the handle, resizing is easy. (MoveWindow Function (Windows))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Size Grip & Window Resizing
    By @nthony in forum Windows Programming
    Replies: 6
    Last Post: 08-23-2007, 04:57 AM