Jump to content
  • Advertisement

Archived

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

Sand_Hawk

Window disappears after MoveWindow call

This topic is 5867 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
Advertisement
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
ShowWindow() does NOT take a bool for the second parameter. It is an int. Look up ShowWindow() to see all the possible commands you can use.



The hackers must have gotten into the system through the hyperlink!!

Invader''s Realm

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
Well, solved the problem. It was with the CW_DEFAULT code that didn''t work. I changed it into 0 and now it works.

Sand Hawk

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


My Site

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!