How to change console window style at runtime?

泪湿孤枕 提交于 2020-01-24 22:47:30

问题


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:


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);


来源:https://stackoverflow.com/questions/41172595/how-to-change-console-window-style-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!