How to change console window style at runtime?

前端 未结 1 1608
故里飘歌
故里飘歌 2020-12-21 13:03

I\'m making a game in console application and I want to prevent user resizing and maximizing window. How can I do this using HWND?

1条回答
  •  不知归路
    2020-12-21 13:42

    I found solution. This code will disable window Size and Maximize box:

    HWND consoleWindow = GetConsoleWindow();
    SetWindowLong(consoleWindow, GWL_STYLE, GetWindowLong(consoleWindow, GWL_STYLE) & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX);
    

    0 讨论(0)
提交回复
热议问题