#include "stdafx.h"
#include "setwnd.h"
#include "PluginMgr.h"
#include "bgwnd.h"
#include "basewnd.h"
class CConfigWnd : public CStandardPageWnd, public IListCallbackUI
{
public:
LPCTSTR GetWindowClassName() const;
void OnFinalMessage(HWND hWnd);
LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
// INotifyUI
virtual void Notify(TNotifyUI& msg);
// IListCallbackUI
LPCTSTR GetItemText(CControlUI* pControl, int iIndex, int iSubItem);
int CompareItem(CControlUI* pList, CControlUI* pItem1, CControlUI* pItem2);
virtual CControlUI* OnCreateCtrlTree();
};
static HWND hDlgSet=NULL;
static BOOL bFirst=TRUE;
INT_PTR ShowSetDialog(void)
{
_TRACE_FUNCTION_;
if (hDlgSet && IsWindow(hDlgSet)) return 0;
CPaintManagerUI::SetResourceInstance(g_hInstance);
CConfigWnd* pWindow = new CConfigWnd;
if( pWindow != NULL )
{
pWindow->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG & (~(WS_VISIBLE)), WS_EX_WINDOWEDGE,CW_USEDEFAULT,CW_USEDEFAULT,600,480);
pWindow->CenterWindow();
pWindow->ShowWindow();
hDlgSet=pWindow->GetHWND();
}
return 0;
}
void CloseSetDialog()
{
_TRACE_FUNCTION_;
if (hDlgSet)
{
SendMessage(hDlgSet,WM_CLOSE,0,0);
hDlgSet=NULL;
}
}
void CConfigWnd::OnFinalMessage(HWND hWnd)
{
CStandardPageWnd::OnFinalMessage(hWnd);
hDlgSet=NULL;
delete this;
}
LPCTSTR CConfigWnd::GetWindowClassName() const
{
return _T("ConfigWnd");
};
LRESULT CConfigWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return CStandardPageWnd::HandleMessage(uMsg, wParam, lParam);
}
CControlUI* CConfigWnd::OnCreateCtrlTree()
{
CDialogBuilder builder;
return builder.CreateFromResource(MAKEINTRESOURCE(IDR_XML2),_T("XML"),this,m_hWnd);
}
void CConfigWnd::Notify(TNotifyUI& msg)
{
if( msg.sType == _T("windowinit") )
{
//获取数据
g_pluginmgr.AquireDataLock();
int nEnabledCount=0,nTotalCount=0;
nTotalCount=g_pluginmgr.GetPluginCount();
nEnabledCount=g_pluginmgr.GetPlugInEnabledCount();
g_pluginmgr.ReleaseDataLock();
//设置列表
CListUI* pList = static_cast<CListUI*>(m_pm.FindControl(_T("pluginlist")));
if (pList)
{
pList->SetTextCallback(this); // We want GetItemText for items
CListTextElementUI* pListElem=NULL;
for (int i=0;i<nTotalCount;i++)
{
pList->Add(new CListTextElementUI);
}
}
//设置标签
TCHAR szTmp[1024];
CTextPanelUI* pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lblwelcome")));
if (pTxt)
{
wsprintf(szTmp,_T(" ") _T("<b><c #00418C>应用服务 (%d/%d)</c></b>"),nEnabledCount,nTotalCount);
pTxt->SetText(szTmp);
}
pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lblcaption")));
if (pTxt)
{
pTxt->SetText(_T(" <b><c #00418C>组件管理</c></b>"));
}
pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lbltxt")));
if (pTxt)
{
wsprintf(szTmp,_T("欢迎来到组件管理中心!在这里,您可以定制组件选项,调用多项强大的功能,让操作更自由,交流更轻松。\n当前,您已经启用%d项服务,还有更多功能和乐趣等待您的发现哦。"),nEnabledCount);
pTxt->SetText(szTmp);
}
CImagePanelUI* pImg = static_cast<CImagePanelUI*>(m_pm.FindControl(_T("imgwelcome")));
if (pImg)
{
pImg->SetImage(MAKEINTRESOURCE(IDB_BITMAP1));
}
CControlUI* pCtrl=m_pm.FindControl(_T("btnset"));
if (pCtrl)
{
pCtrl->SetVisible(FALSE);
}
bFirst=TRUE;
CStatusbarUI* pStatus= static_cast<CStatusbarUI*>(m_pm.FindControl(_T("btnstatus")));
if (pStatus)
{
wsprintf(szTmp,_T("版本: %s"),COMMGR_VERSION);
pStatus->SetText(szTmp);
}
return;
}
if ( msg.sType == _T("itemselect"))
{
if (msg.pSender->GetName() == _T("pluginlist"))
{
CListUI* pList = static_cast<CListUI*>(msg.pSender);
int nCursel=pList->GetCurSel();
g_pluginmgr.AquireDataLock();
if (nCursel>=0 && nCursel<g_pluginmgr.GetPluginCount())
{
const COMINFO& itsel=g_pluginmgr.GetPlugin(nCursel);
BOOL bDisable=itsel.bDisable;
if (!QQinterface::IsHooked()) bDisable=FALSE;//Hook 失败
std_str stmp;
stmp=itsel.strfriendlyname;
if (stmp.empty()) stmp=itsel.strname;
CTextPanelUI* pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lblcaption")));
if (pTxt)
{
TCHAR szTmp[1024];
wsprintf(szTmp,_T(" <b><c #00418C>%s</c></b>"),stmp.c_str());
pTxt->SetText(szTmp);
}
pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lbltxt")));
if (pTxt)
{
pTxt->SetText(itsel.strdescription.c_str());
}
CControlUI* pCtrl=m_pm.FindControl(_T("btnset"));
if (pCtrl)
{
if (bFirst)
{
pCtrl->SetVisible(TRUE);
bFirst=FALSE;
}
pCtrl->SetText(bDisable?_T("启用(&E)"):_T("停用(&E)"));
}
CStatusbarUI* pStatus= static_cast<CStatusbarUI*>(m_pm.FindControl(_T("btnstatus")));
if (pStatus)
{
TCHAR szTmp[1024];
*szTmp=0;
if (bDisable && itsel.strwarning.length())
{
wsprintf(szTmp,_T("<I %d> <c #556E80>%s</c>"),IDI_ICON4,itsel.strwarning.c_str());
}
pStatus->SetText(szTmp);
}
}
g_pluginmgr.ReleaseDataLock();
m_pm.UpdateLayout();//更新控件显示
return;
}
}
if ( msg.sType == _T("click"))
{
if (msg.pSender->GetName() == _T("btnset"))
{
if (!QQinterface::IsHooked())
{
MessageBox(m_hWnd,_T("您的版本无法识别,请更新!"),_T("提示"),MB_ICONINFORMATION);
ShellExecute(m_hWnd,_T("open"),_T("http://231la.com"),NULL,NULL,SW_NORMAL);
return;
}
int nCursel=-1;
CListUI* pList = static_cast<CListUI*>(m_pm.FindControl(_T("pluginlist")));
if (pList)
{
nCursel=pList->GetCurSel();
pList->SetFocus();
}
g_pluginmgr.AquireDataLock();
if (nCursel!=-1 && nCursel<g_pluginmgr.GetPluginCount())
{
const COMINFO& itsel=g_pluginmgr.GetPlugin(nCursel);
BOOL bDisable=itsel.bDisable?FALSE:TRUE;
if (!QQinterface::IsHooked()) bDisable=FALSE;//Hook 失败
g_pluginmgr.UpdatePluginStatus(nCursel,bDisable);
// pList->UpdateLayout();//刷新显示
int nEnabledCount=0,nTotalCount=0;
nTotalCount=g_pluginmgr.GetPluginCount();
nEnabledCount=g_pluginmgr.GetPlugInEnabledCount();
CTextPanelUI* pTxt = static_cast<CTextPanelUI*>(m_pm.FindControl(_T("lblwelcome")));
if (pTxt)
{
TCHAR szTmp[1024];
wsprintf(szTmp,_T(" ") _T("<b><c #00418C>应用服务 (%d/%d)</c></b>"),nEnabledCount,nTotalCount);
pTxt->SetText(szTmp);
}
CControlUI* pCtrl=m_pm.FindControl(_T("btnset"));
if (pCtrl)
{
pCtrl->SetText(bDisable?_T("启用(&E)"):_T("停用(&E)"));
}
CStatusbarUI* pStatus= static_cast<CStatusbarUI*>(m_pm.FindControl(_T("btnstatus")));
if (pStatus)
{
TCHAR szTmp[1024];
*szTmp=0;
if (bDisable && itsel.strwarning.length())
{
wsprintf(szTmp,_T("<I %d> <c #556E80>%s</c>"),IDI_ICON4,itsel.strwarning.c_str());
}
pStatus->SetText(szTmp);
}
std_str stmp;
stmp=itsel.strname;
if (bDisable)
QQinterface::DisablePlugIn(stmp.c_str());
else
QQinterface::EnablePlugIn(stmp.c_str());
}
g_pluginmgr.ReleaseDataLock();
m_pm.UpdateLayout();//更新控件显示
return;
}
}
}
LPCTSTR CConfigWnd::GetItemText(CControlUI* pControl, int iIndex, int iSubItem)
{
static TCHAR szTmp[30]={0};
LPCTSTR pName=_T("");
g_pluginmgr.AquireDataLock();
const COMINFO& ci=g_pluginmgr.GetPlugin(iIndex);
if (iSubItem==0)
{
if (ci.strfriendlyname.empty())
pName=ci.strname.c_str();
else
pName=ci.strfriendlyname.c_str();
}
else
{
if (ci.bDisable && QQinterface::IsHooked())
{
wsprintf(szTmp,_T("<I %d> %s"),IDI_ICON2,_T("已禁用"));
}
else
{
wsprintf(szTmp,_T("<I %d> %s"),IDI_ICON3,_T("已启用"));
}
pName=szTmp;
}
g_pluginmgr.ReleaseDataLock();
return pN
commgr.rar_QQ2009
版权申诉
165 浏览量
2022-09-21
05:01:36
上传
评论
收藏 84KB RAR 举报
weixin_42651887
- 粉丝: 76
- 资源: 1万+
最新资源
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- Highlight Plus v20.0.1
- 基于MIC+NE555光敏电阻的声光控电路Multisim仿真原理图
- python tkinter-08-盒子模型.ev4.rar
- Doozy UI Manager 2023
- 基于matlab实现夜间车牌识别程序(1).rar
- 基于matlab实现无线传感器网络无需测距定位算法matlab源代码 包括apit,dv-hop,amorphous在内的共7个
- 基于python的yolov5实现的旋转目标检测
- 基于matlab实现无线传感器网络 CAB定位仿真程序 这是无线传感器节点定位CAB算法的仿真程序,由matlab完成.rar
- 基于matlab实现图像处理,本程序使用背景差分法对来往车辆进行检测和跟踪.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0