registerHighDPISupport function

void registerHighDPISupport()

Enables per-monitor DPI awareness (V2) for the current process.

This significantly improves rendering quality on high-DPI displays.

If the call fails, a warning is emitted to the debugger output. Failure is non-fatal and typically indicates an unsupported Windows version.

Implementation

void registerHighDPISupport() {
  if (!SetProcessDpiAwarenessContext(
    DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2,
  ).value) {
    final outputString = 'WARNING: Could not set DPI awareness'.toPcwstr();
    OutputDebugString(outputString);
    free(outputString);
  }
}