Merge pull request #464 from VladWinner/main

Make launcher window use dark mode
This commit is contained in:
Maurice Heumann 2023-04-08 07:35:36 +02:00 committed by GitHub
commit e827eb2945
3 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#include <std_include.hpp>
#include "window.hpp"
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif
namespace
{
thread_local uint32_t window_count = 0;
@ -34,6 +38,10 @@ window::window(const std::string& title, const int width, const int height,
this->handle_ = CreateWindowExA(NULL, this->wc_.lpszClassName, title.data(), flags, x, y, width, height, nullptr,
nullptr, this->wc_.hInstance, this);
BOOL value = TRUE;
DwmSetWindowAttribute(this->handle_,
DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
SendMessageA(this->handle_, WM_DPICHANGED, 0, 0);
ShowWindow(this->handle_, SW_SHOW);
SetForegroundWindow(this->handle_);

View File

@ -1,4 +1,5 @@
#pragma once
#pragma comment (lib, "dwmapi.lib")
class window
{

View File

@ -50,6 +50,7 @@
#include <atlsafe.h>
#include <iphlpapi.h>
#include <wincrypt.h>
#include <dwmapi.h>
#include <shellscalingapi.h>
#include <d3d11.h>
#include <dxgi1_6.h>