return OK;
}
+/*
+ * Resize console buffer to 'COORD'
+ */
+ static void
+ResizeConBuf(
+ HANDLE hConsole,
+ COORD coordScreen)
+{
+ if (!SetConsoleScreenBufferSize(hConsole, coordScreen))
+ {
+#ifdef MCH_WRITE_DUMP
+ if (fdDump)
+ {
+ fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n",
+ GetLastError());
+ fflush(fdDump);
+ }
+#endif
+ }
+}
+
+/*
+ * Resize console window size to 'srWindowRect'
+ */
+ static void
+ResizeWindow(
+ HANDLE hConsole,
+ SMALL_RECT srWindowRect)
+{
+ if (!SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect))
+ {
+#ifdef MCH_WRITE_DUMP
+ if (fdDump)
+ {
+ fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
+ GetLastError());
+ fflush(fdDump);
+ }
+#endif
+ }
+}
+
/*
* Set a console window to `xSize' * `ySize'
*/
}
}
- if (!SetConsoleWindowInfo(g_hConOut, TRUE, &srWindowRect))
- {
-#ifdef MCH_WRITE_DUMP
- if (fdDump)
- {
- fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
- GetLastError());
- fflush(fdDump);
- }
-#endif
- }
-
- /* define the new console buffer size */
+ // define the new console buffer size
coordScreen.X = xSize;
coordScreen.Y = ySize;
- if (!SetConsoleScreenBufferSize(hConsole, coordScreen))
+ // In the new console call API in reverse order
+ if (!vtp_working)
{
-#ifdef MCH_WRITE_DUMP
- if (fdDump)
- {
- fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n",
- GetLastError());
- fflush(fdDump);
- }
-#endif
+ ResizeWindow(hConsole, srWindowRect);
+ ResizeConBuf(hConsole, coordScreen);
+ }
+ else
+ {
+ ResizeConBuf(hConsole, coordScreen);
+ ResizeWindow(hConsole, srWindowRect);
}
}