Originally Posted by
Ivory348
How about a suggestion as to how to change the code so it will work?
That's precisely what I suggested in post #19. I don't know if it works or not; I made the suggestion based on john.c's initial suggestion combined with the Basic example that you say works. If you want a working answer served to you on a platter, bye! I'm not going to prepare one for you because I simply cannot: I'm on a Mac right now in the office, and while I dual boot Windows and Linux at home, I generally only program on Linux there.
But come on, it's not hard to try and find a permutation that might work. I mean, there's a bunch of stuff you can try:
Exhibit A:
Code:
void disableMinimizeAndMaximizeButtons(void)
{
HWND hwnd = GetConsoleWindow();
SetWindowLong(hwnd, GWL_STYLE,
GetWindowLong(hwnd, GWL_STYLE) & ~(WS_MAXIMIZEBOX|WS_MINIMIZEBOX));
}
Exhibit B:
Code:
void disableMinimizeAndMaximizeButtons(void)
{
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_STYLE,
GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_MAXIMIZEBOX|WS_MINIMIZEBOX));
}
Exhibit C:
Code:
void disableMinimizeAndMaximizeButtons(void)
{
HWND hwnd = GetConsoleWindow();
SetWindowLong(hwnd, GWL_STYLE,
GetWindowLong(hwnd, GWL_STYLE) ^ (WS_MAXIMIZEBOX|WS_MINIMIZEBOX));
}
Exhibit D
Code:
void disableMinimizeAndMaximizeButtons(void)
{
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_STYLE,
GetWindowLongPtr(hwnd, GWL_STYLE) ^ (WS_MAXIMIZEBOX|WS_MINIMIZEBOX));
}
Exhibit A is john.c's original suggestion, but with the GetConsoleWindow() call.
Exhibit B is Exhibit A but trying GetWindowLongPtr and SetWindowLongPtr as in the Basic example.
Exhibit C is the Basic example, but with GetWindowLong and SetWindowLong instead.
Exhibit D is the Basic example directly translated to C.
Compile each of them at a high warning level and and take note of any warning messages. There might even be a compile error because I am completely guessing about GetWindowLongPtr because the MSDN docs seem to say something different. If there are no warning messages and yet none of them manages to disable the "minimize and mazimize boxes", then it could be that there's something else missing that perhaps the API in the Basic version handles for you.