1

I've created two windows with CreateWindowEx(), and now I'd like to stick them side-by-side, so that whenever one is moved, the other one moves relative to the other.

What's the right way of implementing this?

At the moment, I'm using this piece of code:

case WM_MOVING: // When the main window is being moved
    GetWindowRect(hWnd, &rWnd); // Get the current position of the main window
    MoveWindow(hwStats, rWnd.right - 1, rWnd.top, 140, 450, 1); // Move the other window relative to the main window
    return 1; // WM_MOVING is handled by the application
    break; // Done.

The problem with this, is that whenever I move the window, the other window is dragged a few pixels behind.
Now, it doesn't look too bad, but I'd really prefer if it looked a bit more solid.

4

1 回答 1

1

要解决此问题,我需要将casefrom更改WM_MOVINGWM_MOVE和 function MoveWindow() to SetWindowPos()

感谢 Martin James,他向我介绍了“Windows API 对接”。这很有帮助。

于 2013-01-27T13:53:18.230 回答