WinApi - window style change

I want to change the style of the windsor at runtime. I am using this code

if (this->fullscreen)
{
    this->style = WS_POPUP|WS_VISIBLE;
}
else 
{
    this->style = WS_OVERLAPPED|WS_SYSMENU|WS_VISIBLE;
}

    SetWindowLongPtr(this->mainWindowHandle, GWL_STYLE, this->style);

        SetWindowPos(this->mainWindowHandle, 
                HWND_TOP, 
                0, 
                0,
                0,    //New Width
                0, //New Height, 
            SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);

But this has no effect ... and the window still has no border (WS_POPUP) ...

+3
source share
4 answers

According to MSDN , you cannot change these specific styles after creating a window. If you try anyway, it also says that WS_SYSMENU requires WS_CAPTION.

+2
source

Try calling SetWindowPoswith the flag SWP_DRAWFRAMEand see if it helps.

+1
source

pos . , , pos .

0

Source: https://habr.com/ru/post/1791449/


All Articles