I am creating a windows application in C++. I am using SDL (http://www.libsdl.org/) - however this question applies to many other types of windows applications written in C++ as I have had the same problem before in MFC years ago and never solved this issue.
Now I want my application to start up maximized. Many other applications startup by default in the maximized state, for example when I run firefox, it automatically starts up maximized.
Now I read that I can use ShowWindow http://msdn.microsoft.com/en-us/library/ms633548
By calling:
ShowWindow(info1.window, SW_MAXIMIZE);
The window then maximized when this is called as if the user clicked on the maximized button. However, the problem is that when my application starts, firstly it starts up in a particular size (700 by 500 just for example) then when the ShowWindow gets called, it then maximizes. This is a big difference between how Firefox starts up, Firefox starts up and just appears maximized without appearing at a small size first.
So my question is, how to start up maximized without this intermediate window size (which is not maximized) before the ShowWindow is called? It is annoying for the user to see a smaller window which then maximizes suddenly upon startup.
If you can tell me how to do it in MFC or DOT NET, I can probably work out how to do it in SDL, I guess.
Call the SystemParametersInfo Windows API function with SPI_GETWORKAREA to get the width and height of the screen without the the taskbar, and set your window size when calling CreateWindow to these values. (You could also call GetSystemMetrics with SM_CXSCREEN and SM_CYSCREEN to get the width and the full height of the screen, but in this case the bottom edge of your window would be hidden by the taskbar.)