mirror of
https://github.com/zhongyang219/TrafficMonitor.git
synced 2026-10-17 05:07:21 +08:00
ITrafficMonitor新增GetMainWindowHwnd、GetTaskbarWindowHwnd函数
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
#include "stdafx.h"
|
||||
#include "IDrawCommon.h"
|
||||
|
||||
int IDrawCommon::GetAPIVersion()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IDrawCommon::DrawWindowText(int x, int y, int w, int h, const wchar_t* lpszString, unsigned long color, Alignment align, bool multi_line, unsigned char alpha)
|
||||
{
|
||||
CRect rect(POINT(x, y), SIZE(w, h));
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
virtual int GetTextWidth(LPCTSTR lpszString) { return 0; }
|
||||
|
||||
// 通过 IPluginDrawer 继承
|
||||
virtual int GetAPIVersion() override;
|
||||
virtual void DrawWindowText(int x, int y, int w, int h, const wchar_t* lpszString, unsigned long color, Alignment align, bool multi_line, unsigned char alpha) override;
|
||||
virtual void SetDrawRect(int x, int y, int w, int h) override;
|
||||
virtual void FillRect(int x, int y, int w, int h, unsigned long color, unsigned char alpha) override;
|
||||
|
||||
@@ -1391,7 +1391,7 @@ int CTrafficMonitorApp::ExitInstance()
|
||||
|
||||
int CTrafficMonitorApp::GetAPIVersion()
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const wchar_t* CTrafficMonitorApp::GetVersion()
|
||||
@@ -1477,7 +1477,7 @@ const wchar_t* CTrafficMonitorApp::GetPluginConfigDir() const
|
||||
|
||||
int CTrafficMonitorApp::GetDPI(DPIType type) const
|
||||
{
|
||||
CTrafficMonitorDlg* pMainWnd = dynamic_cast<CTrafficMonitorDlg*>(m_pMainWnd);
|
||||
CTrafficMonitorDlg* pMainWnd = CTrafficMonitorDlg::Instance();
|
||||
switch (type)
|
||||
{
|
||||
case DPI_MAIN_WND:
|
||||
@@ -1493,6 +1493,16 @@ int CTrafficMonitorApp::GetDPI(DPIType type) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* CTrafficMonitorApp::GetMainWindowHwnd()
|
||||
{
|
||||
return m_pMainWnd->GetSafeHwnd();
|
||||
}
|
||||
|
||||
void* CTrafficMonitorApp::GetTaskbarWindowHwnd()
|
||||
{
|
||||
return CTrafficMonitorDlg::Instance()->GetTaskbarWindow()->GetSafeHwnd();
|
||||
}
|
||||
|
||||
const wchar_t* CTrafficMonitorApp::GetStringRes(const wchar_t* key, const wchar_t* section)
|
||||
{
|
||||
return m_str_table.LoadText(key, section).c_str();
|
||||
|
||||
@@ -211,6 +211,8 @@ public:
|
||||
unsigned short GetLanguageId() const override;
|
||||
const wchar_t* GetPluginConfigDir() const override;
|
||||
int GetDPI(DPIType type) const override;
|
||||
virtual void* GetMainWindowHwnd() override;
|
||||
virtual void* GetTaskbarWindowHwnd() override;
|
||||
};
|
||||
|
||||
extern CTrafficMonitorApp theApp;
|
||||
|
||||
@@ -440,6 +440,23 @@ public:
|
||||
* @return
|
||||
*/
|
||||
virtual const wchar_t* GetStringRes(const wchar_t* key, const wchar_t* section) = 0;
|
||||
|
||||
/**
|
||||
* @brief 获取主窗口的句柄
|
||||
* @return
|
||||
*/
|
||||
virtual void* GetMainWindowHwnd() = 0;
|
||||
|
||||
/**
|
||||
* @brief 获取任务栏窗口的句柄。不显示任务栏窗口时,返回值为空
|
||||
* @return
|
||||
*/
|
||||
virtual void* GetTaskbarWindowHwnd() = 0;
|
||||
|
||||
/**
|
||||
* API Version
|
||||
* 1 新增GetMainWindowHwnd、GetTaskbarWindowHwnd函数
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
@@ -447,6 +464,12 @@ public:
|
||||
class IPluginDrawer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief 获取此接口的版本。
|
||||
* @return int
|
||||
*/
|
||||
virtual int GetAPIVersion() = 0;
|
||||
|
||||
// 拉伸模式
|
||||
enum StretchMode
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user