Несмотря на то, что никакие изменения в стилях окон не имеют значения (изменения стиля как при входе, так и при выходе из полноэкранного режима), я смог использовать функцию SetWinEventHook для обнаружения изменений.
// Console Layout Change Detection
// Includes:
#include <Windows.h>
#include <iostream>
// Globals:
HWND g_hWindow;
// EventProc: User defined event procedure callback function
void CALLBACK EventProc(HWINEVENTHOOK hook, DWORD event, HWND wnd, LONG object, LONG child,
DWORD thread, DWORD time) {
std::cout << "Event received...\n";
OutputDebugString(L"Event received...\n");
// ToDo: Respond to layout change here...
}
// Main
int main() {
// Grab the window handle
g_hWindow = GetConsoleWindow();
// Set a window event hook for the console layout changed events such
// as resize, maximise/restore, enter/exit full screen mode, and others...
HWINEVENTHOOK eventHook = SetWinEventHook(EVENT_CONSOLE_LAYOUT, EVENT_CONSOLE_LAYOUT,
NULL, EventProc, 0, 0, WINEVENT_OUTOFCONTEXT);
if (eventHook != 0) std::cout << "Hook started!\n";
else std::cout << "Hook not started!\n";
// Message loop. This one specifically listens for the console layout changed event.
// If the window handle isn't specified, the hook will pick up ANY console window changes,
// not just the one associated with this code.
MSG msg;
while (GetMessage(&msg, g_hWindow, EVENT_CONSOLE_LAYOUT, EVENT_CONSOLE_LAYOUT)) {
DispatchMessage(&msg);
/*...*/
}
}