Compare commits
No commits in common. "2e4e55b4d383f699ea93e1d903b63a1e4cf127cc" and "5c00047718c33d8d0f41085f093294d92b0d9698" have entirely different histories.
2e4e55b4d3
...
5c00047718
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,3 @@
|
|||||||
/.vs
|
/.vs
|
||||||
/Debug
|
/Debug
|
||||||
/*/Debug
|
/*/Debug
|
||||||
/Release
|
|
||||||
/*/Release
|
|
||||||
x64/
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 17.8.34322.80
|
VisualStudioVersion = 16.0.32802.440
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinDevice", "WinDevice\WinDevice.vcxproj", "{FC07175F-EC7A-4CE5-9F7F-976DC6AED04D}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinDevice", "WinDevice\WinDevice.vcxproj", "{FC07175F-EC7A-4CE5-9F7F-976DC6AED04D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace WinDevice {
|
|
||||||
struct OsInfo {
|
|
||||||
// 操作系统名称
|
|
||||||
std::string name;
|
|
||||||
unsigned long majorVersion;
|
|
||||||
unsigned long minorVersion;
|
|
||||||
unsigned long buildNumber;
|
|
||||||
// 总内存大小(以字节为单位)
|
|
||||||
int64_t totalMemory;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CpuInfo {
|
|
||||||
std::string name;
|
|
||||||
int coreCout;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GpuInfo {
|
|
||||||
std::string name;
|
|
||||||
/**
|
|
||||||
* \brief 厂商Id
|
|
||||||
*
|
|
||||||
* 可能的值:
|
|
||||||
* - NVIDIA:0x10DE
|
|
||||||
* - Intel :0x8086
|
|
||||||
* - AMD :0x1002
|
|
||||||
*/
|
|
||||||
uint32_t vendorId;
|
|
||||||
uint32_t deviceId;
|
|
||||||
size_t vram;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DisplayMonitorInfo {
|
|
||||||
std::shared_ptr<HMONITOR> monitor;
|
|
||||||
std::string name;
|
|
||||||
long width;
|
|
||||||
long height;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UserDeviceInfo {
|
|
||||||
std::shared_ptr<CpuInfo> cpu;
|
|
||||||
std::shared_ptr<OsInfo> os;
|
|
||||||
std::shared_ptr<std::vector<GpuInfo>> gpu;
|
|
||||||
std::shared_ptr<std::vector<DisplayMonitorInfo>> monitor;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,230 +0,0 @@
|
|||||||
#include "WinDeviceManager.h"
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include <ddraw.h>
|
|
||||||
#include "../Utils/StringUtil.h"
|
|
||||||
|
|
||||||
namespace WinDevice
|
|
||||||
{
|
|
||||||
WinDeviceManager::WinDeviceManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WinDeviceManager::~WinDeviceManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void WinDeviceManager::_UpdateCpuInfo()
|
|
||||||
{
|
|
||||||
SYSTEM_INFO sysInfo;
|
|
||||||
GetSystemInfo(&sysInfo);
|
|
||||||
|
|
||||||
// 获取CPU信息
|
|
||||||
int cpuInfo[4] = {-1};
|
|
||||||
__cpuid(cpuInfo, 0);
|
|
||||||
unsigned int maxCpuId = cpuInfo[0];
|
|
||||||
|
|
||||||
char cpuBrandString[0x40];
|
|
||||||
memset(cpuBrandString, 0, sizeof(cpuBrandString));
|
|
||||||
|
|
||||||
for (unsigned int i = 0x80000002; i <= 0x80000004; ++i)
|
|
||||||
{
|
|
||||||
__cpuid(cpuInfo, i);
|
|
||||||
memcpy(cpuBrandString + (i - 0x80000002) * 16, cpuInfo, sizeof(cpuInfo));
|
|
||||||
}
|
|
||||||
if (!this->cpuInfo)
|
|
||||||
{
|
|
||||||
this->cpuInfo = std::make_shared<CpuInfo>(*this->cpuInfo);
|
|
||||||
}
|
|
||||||
this->cpuInfo->name = std::string(cpuBrandString);
|
|
||||||
this->cpuInfo->coreCout = sysInfo.dwNumberOfProcessors;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserDeviceInfo WinDeviceManager::GetUserDeviceInfo()
|
|
||||||
{
|
|
||||||
UserDeviceInfo userInfo;
|
|
||||||
|
|
||||||
_UpdateOperatingSystemInfo();
|
|
||||||
_UpdateCpuInfo();
|
|
||||||
_UpdateGpuInfo();
|
|
||||||
// 每次获取主要是因为显示器可能发生变化
|
|
||||||
_UpdateMonitorInfo();
|
|
||||||
|
|
||||||
userInfo.os = std::make_shared<OsInfo>(*osInfo);
|
|
||||||
userInfo.cpu = std::make_shared<CpuInfo>(*cpuInfo);
|
|
||||||
userInfo.gpu = std::make_shared<std::vector<GpuInfo>>(*gpuInfos);
|
|
||||||
userInfo.monitor = std::make_shared<std::vector<DisplayMonitorInfo>>(*monitorInfos);
|
|
||||||
|
|
||||||
return userInfo;
|
|
||||||
}
|
|
||||||
#pragma warning(disable : 4996)
|
|
||||||
void WinDeviceManager::_UpdateOperatingSystemInfo()
|
|
||||||
{
|
|
||||||
if (!osInfo)
|
|
||||||
{
|
|
||||||
osInfo = std::make_shared<OsInfo>(*osInfo);
|
|
||||||
}
|
|
||||||
// 获取操作系统版本信息
|
|
||||||
OSVERSIONINFO osvi;
|
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
||||||
GetVersionEx(&osvi);
|
|
||||||
osInfo->name = Wstring2String(osvi.szCSDVersion);
|
|
||||||
osInfo->majorVersion = static_cast<unsigned long>(osvi.dwMajorVersion);
|
|
||||||
osInfo->minorVersion = static_cast<unsigned long>(osvi.dwMinorVersion);
|
|
||||||
osInfo->buildNumber = static_cast<unsigned long>(osvi.dwBuildNumber);
|
|
||||||
|
|
||||||
// 获取系统内存信息
|
|
||||||
MEMORYSTATUSEX memStatus;
|
|
||||||
ZeroMemory(&memStatus, sizeof(MEMORYSTATUSEX));
|
|
||||||
memStatus.dwLength = sizeof(MEMORYSTATUSEX);
|
|
||||||
GlobalMemoryStatusEx(&memStatus);
|
|
||||||
osInfo->totalMemory = static_cast<int64_t>(memStatus.ullTotalPhys / (1024 * 1024));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WinDeviceManager::_UpdateGpuInfo()
|
|
||||||
{
|
|
||||||
if (!gpuInfos)
|
|
||||||
{
|
|
||||||
gpuInfos = std::make_shared<std::vector<GpuInfo>>(*gpuInfos);
|
|
||||||
}
|
|
||||||
gpuInfos->clear();
|
|
||||||
IDXGIFactory* pFactory = nullptr;
|
|
||||||
CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory));
|
|
||||||
IDXGIAdapter* pAdapter = nullptr;
|
|
||||||
bool isFind = false;
|
|
||||||
for (UINT adapterIndex = 0; pFactory->EnumAdapters(adapterIndex, &pAdapter) != DXGI_ERROR_NOT_FOUND; ++
|
|
||||||
adapterIndex)
|
|
||||||
{
|
|
||||||
DXGI_ADAPTER_DESC adapter_desc;
|
|
||||||
pAdapter->GetDesc(&adapter_desc);
|
|
||||||
GpuInfo gpuInfo;
|
|
||||||
gpuInfo.name = Wstring2String(adapter_desc.Description);
|
|
||||||
gpuInfo.deviceId = static_cast<uint32_t>(adapter_desc.DeviceId);
|
|
||||||
gpuInfo.vendorId = static_cast<uint32_t>(adapter_desc.VendorId);
|
|
||||||
gpuInfo.vram = static_cast<size_t>(adapter_desc.DedicatedVideoMemory);
|
|
||||||
gpuInfos->push_back(gpuInfo);
|
|
||||||
}
|
|
||||||
pFactory->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WinDeviceManager::_EnumMonitorProc(HMONITOR hMonitor)
|
|
||||||
{
|
|
||||||
MONITORINFOEXA miex;
|
|
||||||
miex.cbSize = sizeof(miex);
|
|
||||||
|
|
||||||
if (GetMonitorInfoA(hMonitor, (LPMONITORINFO)&miex))
|
|
||||||
{
|
|
||||||
DisplayMonitorInfo info;
|
|
||||||
info.monitor = std::make_shared<HMONITOR>(hMonitor);
|
|
||||||
info.name = miex.szDevice;
|
|
||||||
info.width = miex.rcMonitor.right - miex.rcMonitor.left;
|
|
||||||
info.height = miex.rcMonitor.bottom - miex.rcMonitor.top;
|
|
||||||
monitorInfos->push_back(info);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL CALLBACK WinDeviceManager::Monitor_enum_proc_(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
|
||||||
{
|
|
||||||
return ((WinDeviceManager*)dwData)->_EnumMonitorProc(hMonitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WinDeviceManager::_UpdateMonitorInfo()
|
|
||||||
{
|
|
||||||
if (!monitorInfos)
|
|
||||||
{
|
|
||||||
monitorInfos = std::make_shared<std::vector<DisplayMonitorInfo>>(*monitorInfos);
|
|
||||||
}
|
|
||||||
monitorInfos->clear();
|
|
||||||
::EnumDisplayMonitors(NULL, NULL, Monitor_enum_proc_, (LPARAM)this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WinDeviceManager::IsDirectDrawAccelerationAvailable()
|
|
||||||
{
|
|
||||||
IDirectDraw* pDirectDraw = nullptr;
|
|
||||||
|
|
||||||
HRESULT hr = DirectDrawCreate(nullptr, &pDirectDraw, nullptr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
// DirectDraw 创建失败,可能是不支持或没有安装 DirectX
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取 DirectDraw 加速信息
|
|
||||||
DDCAPS ddcaps;
|
|
||||||
ZeroMemory(&ddcaps, sizeof(ddcaps));
|
|
||||||
ddcaps.dwSize = sizeof(ddcaps);
|
|
||||||
|
|
||||||
hr = pDirectDraw->GetCaps(&ddcaps, nullptr);
|
|
||||||
pDirectDraw->Release();
|
|
||||||
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
// 获取 DirectDraw 加速信息失败
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否支持硬件加速
|
|
||||||
return (ddcaps.dwCaps & DDCAPS_NOHARDWARE) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WinDeviceManager::IsDirect3DAccelerationAvailable()
|
|
||||||
{
|
|
||||||
D3D_FEATURE_LEVEL featureLevel;
|
|
||||||
|
|
||||||
// 尝试创建硬件设备,如果失败,尝试创建支持较低特性级别的设备
|
|
||||||
HRESULT hr = D3D11CreateDevice(
|
|
||||||
nullptr,
|
|
||||||
D3D_DRIVER_TYPE_HARDWARE,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
D3D11_SDK_VERSION,
|
|
||||||
nullptr,
|
|
||||||
&featureLevel,
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 依次尝试创建支持较低特性级别的设备
|
|
||||||
hr = D3D10CreateDevice(
|
|
||||||
nullptr,
|
|
||||||
D3D10_DRIVER_TYPE_HARDWARE,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
D3D10_SDK_VERSION,
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IDirect3D9* pD3D = Direct3DCreate9(D3D_SDK_VERSION);
|
|
||||||
|
|
||||||
if (pD3D == nullptr)
|
|
||||||
{
|
|
||||||
// DirectX is not installed or not available
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
D3DCAPS9 caps;
|
|
||||||
if (FAILED(pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps)))
|
|
||||||
{
|
|
||||||
// Failed to get device capabilities
|
|
||||||
pD3D->Release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check if Direct3D acceleration is supported
|
|
||||||
const bool accelerationAvailable = (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0;
|
|
||||||
|
|
||||||
pD3D->Release();
|
|
||||||
|
|
||||||
return accelerationAvailable;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "UserDeviceInfo.h"
|
|
||||||
#include <Mmdeviceapi.h>
|
|
||||||
|
|
||||||
namespace WinDevice
|
|
||||||
{
|
|
||||||
class WinDeviceManager {
|
|
||||||
public:
|
|
||||||
WinDeviceManager();
|
|
||||||
~WinDeviceManager();
|
|
||||||
|
|
||||||
UserDeviceInfo GetUserDeviceInfo();
|
|
||||||
static bool IsDirectDrawAccelerationAvailable();
|
|
||||||
static bool IsDirect3DAccelerationAvailable();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<OsInfo> osInfo;
|
|
||||||
std::shared_ptr<CpuInfo> cpuInfo;
|
|
||||||
std::shared_ptr<std::vector<GpuInfo>> gpuInfos;
|
|
||||||
std::shared_ptr<std::vector<DisplayMonitorInfo>> monitorInfos;
|
|
||||||
|
|
||||||
void _UpdateOperatingSystemInfo();
|
|
||||||
void _UpdateCpuInfo();
|
|
||||||
void _UpdateGpuInfo();
|
|
||||||
BOOL _EnumMonitorProc(HMONITOR hMonitor);
|
|
||||||
static BOOL CALLBACK Monitor_enum_proc_(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
|
|
||||||
void _UpdateMonitorInfo();
|
|
||||||
};
|
|
||||||
}
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
void Log::Init(LogLevel level, std::string fileName)
|
void Log::Init(LogLevel level, std::string fileName)
|
||||||
{
|
{
|
||||||
spdlog::set_pattern("[%H:%M:%S %z] [%n] [%^---%L---%$] [thread %t] %v");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::Info(std::string format, std::string args...)
|
void Log::Info(std::string format, std::string args...)
|
||||||
|
@ -11,11 +11,11 @@ To Convert(const From& input) {
|
|||||||
return converter.to_bytes(input);
|
return converter.to_bytes(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string Wstring2String(const std::wstring& input) {
|
std::string Wstring2String(const std::wstring& input) {
|
||||||
return Convert<std::string>(input);
|
return Convert<std::string>(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string Wchar2String(const WCHAR* input) {
|
std::string Wchar2String(const WCHAR* input) {
|
||||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||||
return converter.to_bytes(input);
|
return converter.to_bytes(input);
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,13 @@
|
|||||||
#include "Utils/StringUtil.h"
|
#include "Utils/StringUtil.h"
|
||||||
|
|
||||||
|
|
||||||
ScreenManager::ScreenManager()
|
void SceenManager::UpdateDisplayInfo()
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ScreenManager::~ScreenManager()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenManager::UpdateDisplayInfo()
|
|
||||||
{
|
{
|
||||||
_UpdateDisplayDeviceList();
|
_UpdateDisplayDeviceList();
|
||||||
_UpdateMonitorInfoMap();
|
_UpdateMonitorInfoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenManager::_UpdateDisplayDeviceList()
|
void SceenManager::_UpdateDisplayDeviceList()
|
||||||
{
|
{
|
||||||
spdlog::info("=====GetInfoByEnumDisplayDevices start=====");
|
spdlog::info("=====GetInfoByEnumDisplayDevices start=====");
|
||||||
DISPLAY_DEVICE displayDevice;
|
DISPLAY_DEVICE displayDevice;
|
||||||
@ -40,7 +30,7 @@ void ScreenManager::_UpdateDisplayDeviceList()
|
|||||||
spdlog::info("=====GetInfoByEnumDisplayDevices end=====");
|
spdlog::info("=====GetInfoByEnumDisplayDevices end=====");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ScreenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
BOOL SceenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||||
{
|
{
|
||||||
MONITORINFOEX monitorInfo;
|
MONITORINFOEX monitorInfo;
|
||||||
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
||||||
@ -50,15 +40,15 @@ BOOL ScreenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
|||||||
spdlog::info("_UpdateMonitorInfoMap, szDevice:{0}, right:{1}, bottom:{2}", Wchar2String(monitorInfo.szDevice),
|
spdlog::info("_UpdateMonitorInfoMap, szDevice:{0}, right:{1}, bottom:{2}", Wchar2String(monitorInfo.szDevice),
|
||||||
monitorInfo.rcMonitor.right, monitorInfo.rcMonitor.bottom);
|
monitorInfo.rcMonitor.right, monitorInfo.rcMonitor.bottom);
|
||||||
}
|
}
|
||||||
auto it = ScreenManager::_hMonitorInfoMap.find(hMonitor);
|
auto it = SceenManager::_hMonitorInfoMap.find(hMonitor);
|
||||||
if (it != ScreenManager::_hMonitorInfoMap.end())
|
if (it != SceenManager::_hMonitorInfoMap.end())
|
||||||
{
|
{
|
||||||
// 键已经存在,表示存在重复
|
// 键已经存在,表示存在重复
|
||||||
// 在这里处理重复的情况
|
// 在这里处理重复的情况
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScreenManager::_hMonitorInfoMap.insert(std::make_pair(hMonitor, monitorInfo));
|
SceenManager::_hMonitorInfoMap.insert(std::make_pair(hMonitor, monitorInfo));
|
||||||
// 键不存在,表示没有重复
|
// 键不存在,表示没有重复
|
||||||
// 在这里处理非重复的情况
|
// 在这里处理非重复的情况
|
||||||
}
|
}
|
||||||
@ -83,7 +73,7 @@ BOOL ScreenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spdlog::info("Failed to get display resolution.");
|
spdlog::info(L"Failed to get display resolution.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -93,12 +83,12 @@ BOOL ScreenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ScreenManager::EnumMonitorsProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
BOOL CALLBACK SceenManager::EnumMonitorsProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
||||||
{
|
{
|
||||||
return ((ScreenManager*)dwData)->_EnumMonitorProc(hMonitor);
|
return ((SceenManager*)dwData)->_EnumMonitorProc(hMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenManager::_UpdateMonitorInfoMap()
|
void SceenManager::_UpdateMonitorInfoMap()
|
||||||
{
|
{
|
||||||
spdlog::info("=====GetInfoByEnumDisplayMonitors start=====");
|
spdlog::info("=====GetInfoByEnumDisplayMonitors start=====");
|
||||||
// 枚举显示器
|
// 枚举显示器
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#include <Mmdeviceapi.h>
|
#include <Mmdeviceapi.h>
|
||||||
|
|
||||||
class ScreenManager
|
class SceenManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenManager();
|
SceenManager();
|
||||||
~ScreenManager();
|
~SceenManager();
|
||||||
void UpdateDisplayInfo();
|
void UpdateDisplayInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -11,22 +11,15 @@
|
|||||||
|
|
||||||
#include "Utils/CmdUtil.h"
|
#include "Utils/CmdUtil.h"
|
||||||
#include "Video/ScreenManager.h"
|
#include "Video/ScreenManager.h"
|
||||||
#include "Device/WinDeviceManager.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// const std::string command = "wmic desktopmonitor get PNPDeviceId,ScreenWidth,ScreenHeight";
|
const std::string command = "wmic desktopmonitor get PNPDeviceId,ScreenWidth,ScreenHeight";
|
||||||
// const std::string command_output = CmdUtil::ExecuteCommand(command);
|
const std::string command_output = CmdUtil::ExecuteCommand(command);
|
||||||
// spdlog::info(L"xxxx");
|
SceenManager sceen_manager;
|
||||||
// ScreenManager sceen_manager;
|
sceen_manager.UpdateDisplayInfo();
|
||||||
// sceen_manager.UpdateDisplayInfo();
|
|
||||||
|
|
||||||
spdlog::info("IsDirect3DAccelerationAvailable: {0}", WinDevice::WinDeviceManager::IsDirect3DAccelerationAvailable());
|
|
||||||
spdlog::info("IsDirectDrawAccelerationAvailable: {0}", WinDevice::WinDeviceManager::IsDirectDrawAccelerationAvailable());
|
|
||||||
getchar();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
|
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
|
||||||
|
@ -1 +0,0 @@
|
|||||||
LIBRARY
|
|
@ -72,35 +72,29 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>$(IncludePath);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;</IncludePath>
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86;</LibraryPath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;</IncludePath>
|
|
||||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64;</LibraryPath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;</IncludePath>
|
|
||||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64</LibraryPath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);SPDLOG_WCHAR_FILENAMES</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include\third_lib\;.</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include\third_lib\;.</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>dxgi.lib;cfgmgr32.lib;d3d9.lib;d3d10.lib;d3d11.lib;d3d12.lib;ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>dxgi.lib;cfgmgr32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>WinDevice.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -111,15 +105,13 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include\third_lib\;.</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dxgi.lib;cfgmgr32.lib;d3d9.lib;d3d10.lib;d3d11.lib;d3d12.lib;ddraw.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>WinDevice.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@ -128,13 +120,11 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include\third_lib\;.</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dxgi.lib;cfgmgr32.lib;d3d9.lib;d3d10.lib;d3d11.lib;d3d12.lib;ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>WinDevice.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@ -145,20 +135,17 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include\third_lib\;.</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dxgi.lib;cfgmgr32.lib;d3d9.lib;d3d10.lib;d3d11.lib;d3d12.lib;ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>WinDevice.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Audio\AudioManager.cpp" />
|
<ClCompile Include="Audio\AudioManager.cpp" />
|
||||||
<ClCompile Include="Device\WinDeviceManager.cpp" />
|
|
||||||
<ClCompile Include="Utils\CmdUtil.cpp" />
|
<ClCompile Include="Utils\CmdUtil.cpp" />
|
||||||
<ClCompile Include="Utils\Log.cpp" />
|
<ClCompile Include="Utils\Log.cpp" />
|
||||||
<ClCompile Include="Utils\SysInfoUtil.cpp" />
|
<ClCompile Include="Utils\SysInfoUtil.cpp" />
|
||||||
@ -169,8 +156,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Audio\AudioEnum.h" />
|
<ClInclude Include="Audio\AudioEnum.h" />
|
||||||
<ClInclude Include="Audio\AudioManager.h" />
|
<ClInclude Include="Audio\AudioManager.h" />
|
||||||
<ClInclude Include="Device\UserDeviceInfo.h" />
|
|
||||||
<ClInclude Include="Device\WinDeviceManager.h" />
|
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="Utils\CmdUtil.h" />
|
<ClInclude Include="Utils\CmdUtil.h" />
|
||||||
<ClInclude Include="Utils\Log.h" />
|
<ClInclude Include="Utils\Log.h" />
|
||||||
@ -179,9 +164,6 @@
|
|||||||
<ClInclude Include="Utils\TimeUtil.h" />
|
<ClInclude Include="Utils\TimeUtil.h" />
|
||||||
<ClInclude Include="Video\ScreenManager.h" />
|
<ClInclude Include="Video\ScreenManager.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="WinDevice.def" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
<ClCompile Include="Utils\Log.cpp">
|
<ClCompile Include="Utils\Log.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Device\WinDeviceManager.cpp">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Audio\AudioEnum.h">
|
<ClInclude Include="Audio\AudioEnum.h">
|
||||||
@ -68,16 +65,5 @@
|
|||||||
<ClInclude Include="Utils\StringUtil.h">
|
<ClInclude Include="Utils\StringUtil.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Device\UserDeviceInfo.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Device\WinDeviceManager.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="WinDevice.def">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -90,7 +90,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Uncomment to enable wchar_t support (convert to utf8)
|
// Uncomment to enable wchar_t support (convert to utf8)
|
||||||
//
|
//
|
||||||
#define SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7,21 +7,3 @@
|
|||||||
#include <Psapi.h>
|
#include <Psapi.h>
|
||||||
#include <Shellapi.h>
|
#include <Shellapi.h>
|
||||||
|
|
||||||
|
|
||||||
#include "dxgi.h"
|
|
||||||
#include "WinUser.h"
|
|
||||||
#include <dxgi1_4.h>
|
|
||||||
#include <d3d9.h>
|
|
||||||
#include <d3d9caps.h>
|
|
||||||
#include <d3d11.h>
|
|
||||||
#include <d3d10_1.h>
|
|
||||||
#include <d3d12.h>
|
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
|
||||||
#include <Dwrite.h>
|
|
||||||
|
|
||||||
#include <intrin.h>
|
|
||||||
|
|
||||||
#include "sysinfoapi.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user