c++windowgdicreatewindow

Maximized WS_POPUP window goes in front of the taskbar


I'm creating a window in C++ with that code:

HWnd = CreateWindow(wc.lpszClassName,
    "myapp",
    WS_POPUP |WS_VISIBLE,
    10, 10, 1000, 800, 0, 0, hInst, NULL);

It appears as I want but when I maximize it with like this:

ShowWindow(hwnd, SW_SHOWMAXIMIZED);

then it's like a fullscreen window so that the taskbar is hidden. I think it's because it is a POPUP window but this is like I want it to appear.

Do I need to create my own maximize function or is there a parameter to avoid that ?

Thanks


Solution

  • You can add WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX style.

    If you want your window to be without caption then you will need to adjust window size manually to fit into desktop work area that you can query using SystemParametersInfo specifying SPI_GETWORKAREA flag.