Archived

This topic is now archived and is closed to further replies.

Window disappears after MoveWindow call

This topic is 5584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm resizing an window to make it work properly with DirectDraw. Only problem is that when I resize the window using MoveWindow, my window disappears and doesn't reappear anymore. This is my code for resizing(Was in Tricks....)
      
        // Rect with window size

        RECT WindowRect = {0, 0, ScreenWidth, ScreenHeight};

        // Call AdjustWindowRectEx to change the Rect to the correct size

        AdjustWindowRectEx(&WindowRect,
                           GetWindowLong(hWnd, GWL_STYLE),
                           GetMenu(hWnd) != NULL,
                           GetWindowLong(hWnd, GWL_EXSTYLE));

        // And now resize the window

        MoveWindow(hWnd, 
                   CW_USEDEFAULT, 
                   CW_USEDEFAULT, 
                   WindowRect.right - WindowRect.left,
                   WindowRect.bottom - WindowRect.top,
                   FALSE);

        ShowWindow(hWnd, SW_SHOW);
      
Why does the window disappear? [EDIT] Maybe this helps: I don't process the WM_RESIZE message. Is that a problem? EDIT 2: Changed the ShowWindow code to SW_SHOW [/EDIT] Sand Hawk ---------------- -Earth is 98% full. Please delete anybody you can.
My Site [edited by - sand_hawk on August 28, 2002 6:37:15 PM] [edited by - sand_hawk on August 28, 2002 6:49:37 PM]

Share this post


Link to post
Share on other sites
Isn't the CW_USEDEFAULT used only with CreateWindow?

Try moving to WindowRect.left, WindowRect.top instead and see if that works.

Chances are the CW_USEDEFAULT is some strange value and it thinks you are trying to move it to that coordinate, which it of course doesn't complain about. It just does it, because we program in C, and we all know what we are doing because of that!

[edited by - Waverider on August 28, 2002 6:42:37 PM]

Share this post


Link to post
Share on other sites
I fixed the ShowWindow(hWnd, SW_SHOW) but it still disappears. Anyone knows another solution. Or is there a better way of REZISING the window in code?

*** Server Error ***

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site

Share this post


Link to post
Share on other sites