Alhazred Posted August 5, 2004 Share Posted August 5, 2004 I'd like to know if is possible to disable some console window buttons, i.e minimize and maximize. Does exists an API which allows me to do that? Link to comment Share on other sites More sharing options...
0 Andareed Posted August 5, 2004 Share Posted August 5, 2004 You would first have to somehow obtain an HWND to your console window(s). You could probably use FindWindow(Ex). Then you have to set window style to exclude the maximized style). I would give specific functions but my computer is down atm :( Link to comment Share on other sites More sharing options...
0 Alhazred Posted August 5, 2004 Author Share Posted August 5, 2004 I have no problem to obtain an HWND :) Anyway, I already checked the SetConsoleMode, but I didn't found anything. I'll try to find out something else. Thanks :) Link to comment Share on other sites More sharing options...
0 vcv Posted August 5, 2004 Share Posted August 5, 2004 What you would use is SetWindowLong (or SetWindowLongPtr), with GWL_STYLE as the nIndex (2nd) parameter. ex: SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME); Those are all the styles used in WS_OVERLAPPEDWINDOW, which is mostly commonly used when creating a window, minus the minimize button and maximize button styles. Link to comment Share on other sites More sharing options...
0 Alhazred Posted August 5, 2004 Author Share Posted August 5, 2004 Doesn't SetWindowLong have effect on normal windows (like when you open a folder)? I thought it doesn't have effect on console windows Anyway, I've solved in this way: sm = GetSystemMenu(hWnd, FALSE); RemoveMenu(sm, 4, MF_BYPOSITION); //disable Maximize RemoveMenu(sm, 3, MF_BYPOSITION); //disabile Minimize Link to comment Share on other sites More sharing options...
0 vcv Posted August 6, 2004 Share Posted August 6, 2004 Doesn't SetWindowLong have effect on normal windows (like when you open a folder)?I thought it doesn't have effect on console windows Anyway, I've solved in this way: sm = GetSystemMenu(hWnd, FALSE); RemoveMenu(sm, 4, MF_BYPOSITION); //disable Maximize RemoveMenu(sm, 3, MF_BYPOSITION); //disabile Minimize The console is just another window.. I see no reason why it wouldn't work. And doesn't your code only remove the menu items? Link to comment Share on other sites More sharing options...
0 Alhazred Posted August 7, 2004 Author Share Posted August 7, 2004 No, the minimize and maximize button are shown, but if you click on them nothing happen. Link to comment Share on other sites More sharing options...
Question
Alhazred
I'd like to know if is possible to disable some console window buttons, i.e minimize and maximize. Does exists an API which allows me to do that?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts