forked from zhongyang219/TrafficMonitor
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修正引入GetDpiForMonitor函数后(zhongyang219#1097)在Win7下提示找不到dll的问题
- Loading branch information
1 parent
b85326c
commit 7d52e8a
Showing
6 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "stdafx.h" | ||
#include "DllFunctions.h" | ||
|
||
CDllFunctions::CDllFunctions() | ||
{ | ||
//shellscalingapi | ||
m_shcore_module = ::LoadLibrary(_T("Shcore.dll")); | ||
if (m_shcore_module != NULL) | ||
{ | ||
m_getDpiForMonitor = (_GetDpiForMonitor)::GetProcAddress(m_shcore_module, "GetDpiForMonitor"); | ||
} | ||
} | ||
|
||
CDllFunctions::~CDllFunctions() | ||
{ | ||
if (m_shcore_module != NULL) | ||
{ | ||
FreeLibrary(m_shcore_module); | ||
m_shcore_module = NULL; | ||
} | ||
} | ||
|
||
HRESULT CDllFunctions::GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY) | ||
{ | ||
if (m_getDpiForMonitor != nullptr) | ||
return m_getDpiForMonitor(hmonitor, dpiType, dpiX, dpiY); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
#include <shellscalingapi.h> // °üº¬::GetDpiForMonitor | ||
|
||
typedef HRESULT(WINAPI* _GetDpiForMonitor)(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY); | ||
|
||
class CDllFunctions | ||
{ | ||
public: | ||
CDllFunctions(); | ||
~CDllFunctions(); | ||
|
||
public: | ||
HRESULT GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY); | ||
|
||
private: | ||
_GetDpiForMonitor m_getDpiForMonitor{}; | ||
|
||
private: | ||
HMODULE m_shcore_module{}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters