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?
Asked
Active
Viewed 1,604 times
3
-
I don't think you can do that with an HWND. You're going to need to use the [console API](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx). – Carey Gregory Dec 15 '16 at 20:14
-
When you searched the internet for "msdn c++ prevent window closing API", what showed up? – Thomas Matthews Dec 15 '16 at 20:35
1 Answers
5
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);

Ovidzikas
- 113
- 11