修复编译运行错误
This commit is contained in:
parent
5c00047718
commit
ef9faa08c7
@ -5,13 +5,23 @@
|
||||
#include "Utils/StringUtil.h"
|
||||
|
||||
|
||||
void SceenManager::UpdateDisplayInfo()
|
||||
ScreenManager::ScreenManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ScreenManager::~ScreenManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ScreenManager::UpdateDisplayInfo()
|
||||
{
|
||||
_UpdateDisplayDeviceList();
|
||||
_UpdateMonitorInfoMap();
|
||||
}
|
||||
|
||||
void SceenManager::_UpdateDisplayDeviceList()
|
||||
void ScreenManager::_UpdateDisplayDeviceList()
|
||||
{
|
||||
spdlog::info("=====GetInfoByEnumDisplayDevices start=====");
|
||||
DISPLAY_DEVICE displayDevice;
|
||||
@ -30,7 +40,7 @@ void SceenManager::_UpdateDisplayDeviceList()
|
||||
spdlog::info("=====GetInfoByEnumDisplayDevices end=====");
|
||||
}
|
||||
|
||||
BOOL SceenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||
BOOL ScreenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||
{
|
||||
MONITORINFOEX monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
||||
@ -40,15 +50,15 @@ BOOL SceenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||
spdlog::info("_UpdateMonitorInfoMap, szDevice:{0}, right:{1}, bottom:{2}", Wchar2String(monitorInfo.szDevice),
|
||||
monitorInfo.rcMonitor.right, monitorInfo.rcMonitor.bottom);
|
||||
}
|
||||
auto it = SceenManager::_hMonitorInfoMap.find(hMonitor);
|
||||
if (it != SceenManager::_hMonitorInfoMap.end())
|
||||
auto it = ScreenManager::_hMonitorInfoMap.find(hMonitor);
|
||||
if (it != ScreenManager::_hMonitorInfoMap.end())
|
||||
{
|
||||
// 键已经存在,表示存在重复
|
||||
// 在这里处理重复的情况
|
||||
}
|
||||
else
|
||||
{
|
||||
SceenManager::_hMonitorInfoMap.insert(std::make_pair(hMonitor, monitorInfo));
|
||||
ScreenManager::_hMonitorInfoMap.insert(std::make_pair(hMonitor, monitorInfo));
|
||||
// 键不存在,表示没有重复
|
||||
// 在这里处理非重复的情况
|
||||
}
|
||||
@ -73,7 +83,7 @@ BOOL SceenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info(L"Failed to get display resolution.");
|
||||
spdlog::info("Failed to get display resolution.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -83,12 +93,12 @@ BOOL SceenManager::_EnumMonitorProc(HMONITOR hMonitor)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK SceenManager::EnumMonitorsProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
||||
BOOL CALLBACK ScreenManager::EnumMonitorsProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
||||
{
|
||||
return ((SceenManager*)dwData)->_EnumMonitorProc(hMonitor);
|
||||
return ((ScreenManager*)dwData)->_EnumMonitorProc(hMonitor);
|
||||
}
|
||||
|
||||
void SceenManager::_UpdateMonitorInfoMap()
|
||||
void ScreenManager::_UpdateMonitorInfoMap()
|
||||
{
|
||||
spdlog::info("=====GetInfoByEnumDisplayMonitors start=====");
|
||||
// 枚举显示器
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include <Mmdeviceapi.h>
|
||||
|
||||
class SceenManager
|
||||
class ScreenManager
|
||||
{
|
||||
public:
|
||||
SceenManager();
|
||||
~SceenManager();
|
||||
ScreenManager();
|
||||
~ScreenManager();
|
||||
void UpdateDisplayInfo();
|
||||
|
||||
private:
|
||||
|
@ -18,7 +18,7 @@ int main()
|
||||
{
|
||||
const std::string command = "wmic desktopmonitor get PNPDeviceId,ScreenWidth,ScreenHeight";
|
||||
const std::string command_output = CmdUtil::ExecuteCommand(command);
|
||||
SceenManager sceen_manager;
|
||||
ScreenManager sceen_manager;
|
||||
sceen_manager.UpdateDisplayInfo();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user