mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:48:35 +00:00
RegisterAppStateChangeNotification / UnregisterAppStateChangeNotification under
api-ms-win-core-psm-appnotify-l1-1-0/-l1-1-1 and kernelbase.dll, and CreateWindowExW/A under
user32.dll and ext-ms-win-rtcore-ntuser-window-l1-1-0/-l1-1-1, plus CreateWindowExA under
ext-ms-win-rtcore-ntuser-window-ansi-l1-1-0, the set the title's import table names. The title's
first top-level window is fitted to the work area and hooked: SC_CLOSE runs the suspend callbacks
(quiesced TRUE) and ends the run through the title's ExitProcess, with a 1 s deadline.
Split from #401 (a02134a9c), as the maintainer asked for one topic per pull request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
795 B
C++
22 lines
795 B
C++
// App lifecycle notifications (RegisterAppStateChangeNotification / UnregisterAppStateChangeNotification) and
|
|
// oversized top-level console window fitting + suspend-on-close hook (CreateWindowExA/W).
|
|
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#include <cstddef>
|
|
#include <utility>
|
|
|
|
namespace rt::lifecycle {
|
|
|
|
// Scales down (width, height) proportionally to fit inside `area`, leaving fitting sizes and CW_USEDEFAULT / <= 0
|
|
// unchanged.
|
|
std::pair<int, int> fit_window_to_area(const RECT& area, int width, int height);
|
|
|
|
// For tests: number of currently registered app-state change callbacks, and synchronous suspend invocation
|
|
// (quiesced = TRUE) without terminating the process.
|
|
std::size_t registered_notification_count();
|
|
void invoke_suspend_callbacks_for_test();
|
|
|
|
} // namespace rt::lifecycle
|