Jump to content
  • Advertisement

Archived

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

ga

SetWindowPlacement()

This topic is 6942 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 want to use SetWindowPlacement() to maximize my application window and I tried it with following WINDOWPLACEMENT structure: WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT), WPF_RESTORETOMAXIMIZED, SW_SHOWMINIMIZED, 0,0,0}; But SetWindowPlacement() fails. Does anyone know why? Visit our homepage: www.rarebyte.de.st GA

Share this post


Link to post
Share on other sites
Advertisement
im not an api expert, but shouldnt you pass SW_SHOWMAXIMIZED instead of SW_SHOWMINIMIZED
call extended error information to get a better idea of what the problem is

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
im not an api expert, but shouldnt you pass SW_SHOWMAXIMIZED instead of SW_SHOWMINIMIZED
call extended error information to get a better idea of what the problem is

Share this post


Link to post
Share on other sites
I tried SW_SHOWMAXIMIZED first, it didn''t work;
I read that I must write SW_SHOWMINIMIZED if I give WPF_RESTORETOMAXIMIZED as 2nd parameter. But SetWindowPlacement() always returns 0 -> failure.

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

WINDOWPLACEMENT wndpl = {
sizeof(WINDOWPLACEMENT),
WPF_RESTORETOMAXIMIZED,
SW_SHOWMINIMIZED,
0,0,0};



I don´t think you can write this, because parameter 4 and 5 is a POINT, while 6 is a RECT, you are only telling the compiler to zero the 4th parameter and half of 5th, so parameter 6 (The RECT) could be anything.

instead write:
WINDOWPLACEMENT wndpl;
ZeroMemory(&wndpl, sizeof(wndpl));
wndpl.length = sizeof(wndpl);
wndpl.flags = WPF_RESTORETOMAXIMIZED;
wndpl.showCmd = SW_SHOWMINIMIZED;

SetWindowPlacement(hWnd, &wndpl);

- Hope this will work -

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!