adjust gui.
This commit is contained in:
parent
18f6779bcc
commit
418395edf0
|
@ -1,184 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "PanelDlg.h"
|
||||
#include "ClientControlPanelManager.h"
|
||||
|
||||
ClientControlPanelManager::ClientControlPanelManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ClientControlPanelManager::~ClientControlPanelManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOL ClientControlPanelManager::Init()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ClientControlPanelManager::Deinit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOL ClientControlPanelManager::OpenControlPanel( LPCTSTR clientid )
|
||||
{
|
||||
BOOL bAlreadyExists = TRUE;
|
||||
CPanelDlg* pPanel = NULL;
|
||||
CString strClientId = clientid;
|
||||
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
PanelMap::iterator iter = m_map.find(strClientId);
|
||||
if (iter == m_map.end())
|
||||
{
|
||||
bAlreadyExists = FALSE;
|
||||
|
||||
pPanel = new CPanelDlg();
|
||||
m_map.insert(PanelMap::value_type(strClientId, pPanel));
|
||||
pPanel->SetClientID(strClientId);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPanel = iter->second;
|
||||
SwitchToThisWindow(pPanel->GetSafeHwnd(),TRUE);
|
||||
pPanel = NULL;
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
|
||||
if (NULL != pPanel)
|
||||
{
|
||||
pPanel->DoModal();
|
||||
NotifyControlPanelClosed(strClientId);
|
||||
}
|
||||
return !bAlreadyExists;
|
||||
}
|
||||
|
||||
CPanelDlg* ClientControlPanelManager::GetControlPanel( LPCTSTR clientid )
|
||||
{
|
||||
CPanelDlg* pPanel = NULL;
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
PanelMap::iterator iter = m_map.find(clientid);
|
||||
if (iter != m_map.end())
|
||||
{
|
||||
pPanel = iter->second;
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
|
||||
return pPanel;
|
||||
}
|
||||
|
||||
void ClientControlPanelManager::DelWorkThread(LPCTSTR clientid,DWORD id)
|
||||
{
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
ThreadIdMap::iterator it = m_threadList.find(clientid);
|
||||
|
||||
if (it != m_threadList.end())
|
||||
{
|
||||
ThreadIdList::iterator listit = it->second.begin();
|
||||
for (; listit != it->second.end(); listit++)
|
||||
{
|
||||
if (*listit)
|
||||
{
|
||||
listit = it->second.erase(listit);
|
||||
}
|
||||
if (listit == it->second.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
}
|
||||
|
||||
void ClientControlPanelManager::AddWorkThread(LPCTSTR clientid,DWORD id)
|
||||
{
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
ThreadIdMap::iterator it = m_threadList.find(clientid);
|
||||
|
||||
if (it != m_threadList.end())
|
||||
{
|
||||
it->second.push_back(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadIdList list;
|
||||
list.push_back(id);
|
||||
m_threadList.insert(MAKE_PAIR(ThreadIdMap,clientid,list));
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
}
|
||||
|
||||
|
||||
void ClientControlPanelManager::HandleModuleMsg(LPCTSTR clientid, UINT nMsg, LPVOID lpContext, LPVOID lpParameter)
|
||||
{
|
||||
DWORD id = GetCurrentThreadId();
|
||||
ClientControlPanelManager::GetInstanceRef().AddWorkThread(clientid,id);
|
||||
|
||||
CPanelDlg* pPanel = ClientControlPanelManager::GetInstanceRef().GetControlPanel(clientid);
|
||||
|
||||
if (pPanel == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pPanel->HandleModuleMsg(nMsg,lpContext,lpParameter);
|
||||
ClientControlPanelManager::GetInstanceRef().DelWorkThread(clientid,id);
|
||||
|
||||
}
|
||||
BOOL ClientControlPanelManager::ClosePanelDlg(LPCTSTR clientid)
|
||||
{
|
||||
BOOL bRet = FALSE;
|
||||
CPanelDlg* pPanel = NULL;
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
PanelMap::iterator iter = m_map.find(clientid);
|
||||
if (iter != m_map.end())
|
||||
{
|
||||
pPanel = iter->second;
|
||||
pPanel->SendMessage(WM_CLOSE,0,0);
|
||||
bRet = TRUE;
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
return bRet;
|
||||
}
|
||||
void ClientControlPanelManager::NotifyControlPanelClosed( LPCTSTR clientid )
|
||||
{
|
||||
CPanelDlg* pPanel = NULL;
|
||||
m_mapSection.Enter();
|
||||
{
|
||||
ThreadIdMap::iterator it = m_threadList.find(clientid);
|
||||
if (it != m_threadList.end())
|
||||
{
|
||||
ThreadIdList::iterator listit = it->second.begin();
|
||||
for (; listit != it->second.end(); listit++)
|
||||
{
|
||||
HANDLE hThread = OpenThread(THREAD_ALL_ACCESS,FALSE,*listit);
|
||||
TerminateThread(hThread,0);
|
||||
}
|
||||
m_threadList.erase(it);
|
||||
}
|
||||
PanelMap::iterator iter = m_map.find(clientid);
|
||||
if (iter != m_map.end())
|
||||
{
|
||||
pPanel = iter->second;
|
||||
delete pPanel;
|
||||
m_map.erase(iter);
|
||||
}
|
||||
}
|
||||
m_mapSection.Leave();
|
||||
}
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#pragma once
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include "PanelDlg.h"
|
||||
|
||||
class ClientControlPanelManager
|
||||
{
|
||||
DECLARE_SINGLETON(ClientControlPanelManager);
|
||||
public:
|
||||
BOOL OpenControlPanel(LPCTSTR clientid);
|
||||
static void CALLBACK HandleModuleMsg(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
void NotifyControlPanelClosed(LPCTSTR clientid);
|
||||
CPanelDlg* GetControlPanel(LPCTSTR clientid);
|
||||
void AddWorkThread(LPCTSTR clientid,DWORD id);
|
||||
void DelWorkThread(LPCTSTR clientid,DWORD id);
|
||||
BOOL ModuleCallBack(LPCTSTR clientid, LPCTSTR strFunc, const CStringArray& paramArray, CString& ret);
|
||||
BOOL ClosePanelDlg(LPCTSTR clientid);
|
||||
private:
|
||||
typedef std::map<CString, CPanelDlg*> PanelMap;
|
||||
typedef std::list<DWORD> ThreadIdList;
|
||||
typedef std::map<CString,ThreadIdList> ThreadIdMap;
|
||||
private:
|
||||
CriticalSection m_mapSection;
|
||||
PanelMap m_map;
|
||||
ThreadIdMap m_threadList;
|
||||
};
|
|
@ -87,6 +87,19 @@ void CCmdDlg::EnableButton(BOOL isOpen)
|
|||
|
||||
BOOL CCmdDlg::OnInitDialog()
|
||||
{
|
||||
CString strTitle;
|
||||
CLIENT_INFO info;
|
||||
|
||||
GetClientInfo(m_clientid,&info);
|
||||
|
||||
IN_ADDR connectIP;
|
||||
connectIP.S_un.S_addr = info.connectIP;
|
||||
|
||||
strTitle.Format(_T("Commander [%s][%s]"),info.computerName,CString(inet_ntoa(connectIP)).GetBuffer());
|
||||
|
||||
SetWindowText(strTitle);
|
||||
|
||||
|
||||
__super::OnInitDialog();
|
||||
|
||||
InitDisable();
|
||||
|
@ -102,14 +115,13 @@ BOOL CCmdDlg::OnInitDialog()
|
|||
|
||||
void CCmdDlg::OnBnClickedButtonOpen()
|
||||
{
|
||||
if (OpenShell(m_clientid,m_handleMsg,this))
|
||||
if (OpenShell(m_clientid,HandleModuleMsg,this))
|
||||
{
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,_T("Open cmdshell success!"));
|
||||
EnableButton(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CommitNotifyMsg(MODULE_TYPE_ERROR,_T("Open cmdshell error!"));
|
||||
AfxMessageBox(_T("Open Commander Error!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +129,6 @@ void CCmdDlg::OnBnClickedButtonOpen()
|
|||
void CCmdDlg::OnBnClickedButtonClose()
|
||||
{
|
||||
CloseShell((LPCWSTR)m_clientid.GetBuffer());
|
||||
CommitNotifyMsg(MODULE_TYPE_ERROR,_T("Close cmdshell success!"));
|
||||
EnableButton(FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
|
||||
// 对话框数据
|
||||
enum { IDD = IDD_DIALOG_CMD };
|
||||
static void HandleModuleMsg(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
static void CALLBACK HandleModuleMsg(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
void HandleModuleMsgProc(UINT nMsg,LPVOID lpContext,LPVOID lpParameter);
|
||||
|
||||
void EnableButton(BOOL isOpen);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "FileMgrDlg.h"
|
||||
#include "IconLoader.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "DownDlg.h"
|
||||
#include "json/json.h"
|
||||
|
||||
|
||||
|
@ -92,26 +93,24 @@ void CFileMgrDlg::HandleRemoteFile(UINT nMsg, LPVOID lpContext, LPVOID lpParamet
|
|||
|
||||
void CFileMgrDlg::GetRemoteList(CString strPath)
|
||||
{
|
||||
OutputLog(strPath);
|
||||
|
||||
if (strPath.GetLength() == 0)
|
||||
{
|
||||
AsynListDisks(m_clientid,TRUE,this);
|
||||
AsynListDisks(m_clientid,TRUE,HandleModuleMsg,this);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsynListFiles(m_clientid,strPath,TRUE,this);
|
||||
AsynListFiles(m_clientid,strPath,TRUE,HandleModuleMsg,this);
|
||||
}
|
||||
}
|
||||
void CFileMgrDlg::GetLocalList(CString strPath)
|
||||
{
|
||||
if (strPath.GetLength() == 0)
|
||||
{
|
||||
AsynListDisks(m_clientid,FALSE,NULL);
|
||||
AsynListDisks(m_clientid,FALSE,HandleModuleMsg,this);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsynListFiles(m_clientid,strPath,FALSE,NULL);
|
||||
AsynListFiles(m_clientid,strPath,FALSE,HandleModuleMsg,this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,6 @@ void CFileMgrDlg::InsertFileList( char* lpJson,BOOL isRemote )
|
|||
|
||||
if (strJson == "null\n")
|
||||
{
|
||||
CommitNotifyMsg(MODULE_TYPE_WARNING,_T("Dictionary is null!"));
|
||||
int nId = isRemote ? IDC_EDIT_RCURDIC : IDC_EDIT_LCURDIC;
|
||||
CString strCurDir = isRemote ? m_rCurDir : m_lCurDir;
|
||||
SetDlgItemText(nId,strCurDir+"\\");
|
||||
|
@ -201,20 +199,6 @@ void CFileMgrDlg::InsertFileList( char* lpJson,BOOL isRemote )
|
|||
}
|
||||
}
|
||||
|
||||
void CFileMgrDlg::OutputLog(CString strPath)
|
||||
{
|
||||
CString strNotify;
|
||||
if (strPath.GetLength() == 0)
|
||||
{
|
||||
strNotify = _T("Request disk list");
|
||||
}
|
||||
else
|
||||
{
|
||||
strNotify.Format(_T("Request [%s]"),strPath.GetBuffer());
|
||||
}
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,strNotify);
|
||||
}
|
||||
|
||||
void CFileMgrDlg::InitView()
|
||||
{
|
||||
m_ImageList.Create(16,16,ILC_COLOR8|ILC_MASK,2,1);
|
||||
|
@ -422,10 +406,6 @@ void CFileMgrDlg::OnBnClickedButtonUpload()
|
|||
strRemote += filename;
|
||||
strLocal += filename;
|
||||
|
||||
CString log;
|
||||
log.Format(_T("Upload [%s]"),strRemote);
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,log);
|
||||
|
||||
PutFileToClient(m_clientid,strLocal,strRemote);
|
||||
}
|
||||
|
||||
|
@ -467,10 +447,6 @@ void CFileMgrDlg::OnBnClickedButtonDown()
|
|||
strRemote += filename;
|
||||
strLocal += filename;
|
||||
|
||||
CString log;
|
||||
log.Format(_T("Download [%s]"),strRemote);
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,log);
|
||||
|
||||
GetFileToServer(m_clientid,strRemote,strLocal);
|
||||
}
|
||||
|
||||
|
@ -495,11 +471,6 @@ void CFileMgrDlg::OnBnClickedButtonRun()
|
|||
|
||||
strRemote += filename;
|
||||
|
||||
|
||||
CString log;
|
||||
log.Format(_T("Run [%s]"),strRemote);
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,log);
|
||||
|
||||
RunRemoteFile(m_clientid,strRemote);
|
||||
}
|
||||
|
||||
|
@ -523,11 +494,6 @@ void CFileMgrDlg::OnBnClickedButtonDelete()
|
|||
|
||||
strRemote += filename;
|
||||
|
||||
|
||||
CString log;
|
||||
log.Format(_T("Delete [%s]"),strRemote);
|
||||
CommitNotifyMsg(MODULE_TYPE_INFO,log);
|
||||
|
||||
DeleteRemoteFile(m_clientid,strRemote);
|
||||
}
|
||||
|
||||
|
@ -580,7 +546,6 @@ void CFileMgrDlg::OnNMRClickListRfile(NMHDR *pNMHDR, LRESULT *pResult)
|
|||
*pResult = 0;
|
||||
}
|
||||
|
||||
#include "DownDlg.h"
|
||||
void CFileMgrDlg::OnClickDownFile()
|
||||
{
|
||||
CString strPath;
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
enum { IDD = IDD_DIALOG_FILE };
|
||||
|
||||
//处理模块消息
|
||||
static void HandleModuleMsg(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
static void CALLBACK HandleModuleMsg(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
void HandleModuleMsgProc(UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
|
||||
protected:
|
||||
|
@ -26,9 +26,6 @@ protected:
|
|||
void InitView();
|
||||
void InitData();
|
||||
|
||||
//输出控制板信息
|
||||
void OutputLog(CString strLog);
|
||||
|
||||
//设置对话框字段名
|
||||
void SetColumn(CListCtrl* list,LPTSTR text,int nCol,int nWidth);
|
||||
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
// PanelDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Trochilus.h"
|
||||
#include "FilePanelDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
// CPanelDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFilePanelDlg, CDialogEx)
|
||||
|
||||
CFilePanelDlg::CFilePanelDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(CFilePanelDlg::IDD, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CFilePanelDlg::~CFilePanelDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CFilePanelDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_TAB_PANEL, m_TabCtrl);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFilePanelDlg, CDialogEx)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_PANEL, &CFilePanelDlg::OnTcnSelchangeTabPanel)
|
||||
ON_WM_CLOSE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CPanelDlg 消息处理程序
|
||||
void CFilePanelDlg::InitInsideModule()
|
||||
{
|
||||
CRect rs;
|
||||
m_TabCtrl.GetClientRect(&rs);
|
||||
rs.top += 21;
|
||||
|
||||
m_TabCtrl.InsertItem(0,_T("File Manager"));
|
||||
m_TabCtrl.InsertItem(1,_T("Transfer"));
|
||||
|
||||
CLIENT_INFO info;
|
||||
GetClientInfo(m_clientid,&info);
|
||||
|
||||
FileDlg.Create(IDD_DIALOG_FILE);
|
||||
TransDlg.Create(IDD_DIALOG_TRANSFER);
|
||||
|
||||
CWnd* pWnd = CWnd::FromHandle(m_TabCtrl.GetSafeHwnd());
|
||||
|
||||
FileDlg.SetParent(pWnd);
|
||||
TransDlg.SetParent(pWnd);
|
||||
|
||||
TransDlg.MoveWindow(&rs);
|
||||
FileDlg.MoveWindow(&rs);
|
||||
|
||||
FileDlg.ShowWindow(TRUE);
|
||||
TransDlg.ShowWindow(FALSE);
|
||||
}
|
||||
|
||||
|
||||
void CFilePanelDlg::InitData()
|
||||
{
|
||||
InitInsideModule();
|
||||
}
|
||||
|
||||
void CFilePanelDlg::InitView()
|
||||
{
|
||||
CString strTitle;
|
||||
CLIENT_INFO info;
|
||||
|
||||
GetClientInfo(m_clientid,&info);
|
||||
|
||||
IN_ADDR connectIP;
|
||||
connectIP.S_un.S_addr = info.connectIP;
|
||||
|
||||
strTitle.Format(_T("Control Panel [%s][%s]"),info.computerName,CString(inet_ntoa(connectIP)).GetBuffer());
|
||||
|
||||
SetWindowText(strTitle);
|
||||
}
|
||||
|
||||
BOOL CFilePanelDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
InitView();
|
||||
InitData();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CFilePanelDlg::OnTcnSelchangeTabPanel(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
{
|
||||
int nSel = m_TabCtrl.GetCurSel();
|
||||
|
||||
if (0 == nSel)
|
||||
{
|
||||
FileDlg.ShowWindow(TRUE);
|
||||
TransDlg.ShowWindow(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileDlg.ShowWindow(FALSE);
|
||||
TransDlg.ShowWindow(TRUE);
|
||||
}
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CFilePanelDlg::OnClose()
|
||||
{
|
||||
CDialogEx::OnClose();
|
||||
}
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
|
||||
|
||||
class CPanelDlg : public CDialogEx
|
||||
class CFilePanelDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CPanelDlg)
|
||||
DECLARE_DYNAMIC(CFilePanelDlg)
|
||||
|
||||
public:
|
||||
CPanelDlg(CWnd* pParent = NULL);
|
||||
virtual ~CPanelDlg();
|
||||
CFilePanelDlg(CWnd* pParent = NULL);
|
||||
virtual ~CFilePanelDlg();
|
||||
// 对话框数据
|
||||
enum { IDD = IDD_DIALOG_PANEL };
|
||||
|
||||
|
@ -27,12 +27,8 @@ public:
|
|||
void InitView();
|
||||
void InitData();
|
||||
void InitInsideModule();
|
||||
void InitOutsideModule();
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
//处理模块回调消息
|
||||
void HandleModuleMsg(UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
|
||||
//处理模块状态信息
|
||||
void HandleMsgNotify(UINT nType, LPCTSTR lpContext);
|
||||
|
||||
|
@ -43,28 +39,24 @@ public:
|
|||
void SetClientID(LPCTSTR clientid)
|
||||
{
|
||||
m_clientid = clientid;
|
||||
|
||||
FileDlg.InitModule(clientid);
|
||||
TransDlg.InitModule(clientid);
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
CTabCtrl m_TabCtrl;
|
||||
CListCtrl m_msgList;
|
||||
CImageList m_ImageList;
|
||||
|
||||
typedef std::map<tstring,tstring> ModuleCallBack;
|
||||
ModuleCallBack m_moduleinfo;
|
||||
|
||||
CString m_clientid;
|
||||
ModuleMap m_moduleMap;
|
||||
CriticalSection m_csModuleMap;
|
||||
|
||||
typedef std::list<CString> ClientModList;
|
||||
ClientModList m_clientModList;
|
||||
|
||||
|
||||
typedef std::list<CDialogEx*> NewMemList;
|
||||
|
||||
NewMemList m_MemList;
|
||||
CFileMgrDlg FileDlg;
|
||||
CTransferDlg TransDlg;
|
||||
|
||||
public:
|
||||
afx_msg void OnClose();
|
|
@ -6,6 +6,8 @@
|
|||
#include "HostDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "TrochilusDlg.h"
|
||||
#include "FilePanelDlg.h"
|
||||
#include "CmdDlg.h"
|
||||
|
||||
// CHostDlg 对话框
|
||||
|
||||
|
@ -23,12 +25,17 @@ CHostDlg::~CHostDlg()
|
|||
void CHostDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_LIST_CLIENT, m_ClientList);
|
||||
DDX_Control(pDX, IDC_LIST_CLIENT, m_Clientlist);
|
||||
}
|
||||
|
||||
void CHostDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
{
|
||||
CDialog::OnSysCommand(nID, lParam);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHostDlg, CDialogEx)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_SYSCOMMAND()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
@ -36,7 +43,7 @@ END_MESSAGE_MAP()
|
|||
|
||||
void CHostDlg::StartPanel(CLIENT_INFO& info,LPVOID lpParameter)
|
||||
{
|
||||
ClientControlPanelManager::GetInstanceRef().OpenControlPanel(info.clientid);
|
||||
//msgManager::GetInstanceRef().OpenControlPanel(info.clientid);
|
||||
}
|
||||
void CHostDlg::ClientInfoNotify(UINT nMsg, LPVOID lpContext, LPVOID lpParameter)
|
||||
{
|
||||
|
@ -63,27 +70,26 @@ void CALLBACK CHostDlg::ClientInfoNotifyProc( UINT nMsg,CLIENT_INFO* pInfo )
|
|||
{
|
||||
m_clients[pInfo->clientid] = *pInfo;
|
||||
g_online++;
|
||||
int i = m_ClientList.AddClientInfo(&m_clients[pInfo->clientid]);
|
||||
int i = m_Clientlist.AddClientInfo(&m_clients[pInfo->clientid]);
|
||||
|
||||
m_ClientList.SetItemColor((int)&m_clients[pInfo->clientid],RGB(255,0,0));
|
||||
m_ClientList.Update(i);
|
||||
m_Clientlist.SetItemColor((int)&m_clients[pInfo->clientid],RGB(255,0,0));
|
||||
m_Clientlist.Update(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ClientList.SetItemColor((int)&m_clients[pInfo->clientid],RGB(255,0,0));
|
||||
int i = m_ClientList.GetIdByData((int)&m_clients[pInfo->clientid]);
|
||||
m_ClientList.Update(i);
|
||||
m_Clientlist.SetItemColor((int)&m_clients[pInfo->clientid],RGB(255,0,0));
|
||||
int i = m_Clientlist.GetIdByData((int)&m_clients[pInfo->clientid]);
|
||||
m_Clientlist.Update(i);
|
||||
}
|
||||
|
||||
m_ClientList.SetAlive(pInfo->clientid,TRUE);
|
||||
m_Clientlist.SetAlive(pInfo->clientid,TRUE);
|
||||
}
|
||||
else if(nMsg == WM_DEL_CLIENT)
|
||||
{
|
||||
if (it != m_clients.end())
|
||||
{
|
||||
m_ClientList.SetAlive(pInfo->clientid,FALSE);
|
||||
ClientControlPanelManager::GetInstanceRef().ClosePanelDlg(pInfo->clientid);
|
||||
m_ClientList.DeleteClientInfo(&m_clients[pInfo->clientid]);
|
||||
m_Clientlist.SetAlive(pInfo->clientid,FALSE);
|
||||
m_Clientlist.DeleteClientInfo(&m_clients[pInfo->clientid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,17 +116,17 @@ void CHostDlg::InitResize()
|
|||
void CHostDlg::InitView()
|
||||
{
|
||||
//初始化在线主机列表
|
||||
m_ClientList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
||||
m_ClientList.InsertColumn(0,_T("Computer Name"),LVCFMT_CENTER,130,-1);
|
||||
m_ClientList.InsertColumn(1,_T("Lan"),LVCFMT_CENTER,120,-1);
|
||||
m_ClientList.InsertColumn(2,_T("W-Lan"),LVCFMT_CENTER,115,-1);
|
||||
m_ClientList.InsertColumn(3,_T("OS"),LVCFMT_CENTER,130,-1);
|
||||
m_ClientList.InsertColumn(4,_T("CPU Frep"),LVCFMT_CENTER,140,-1);
|
||||
m_ClientList.InsertColumn(5,_T("Memory(MB)"),LVCFMT_CENTER,140,-1);
|
||||
m_ClientList.InsertColumn(6,_T("Languge"),LVCFMT_CENTER,140,-1);
|
||||
m_ClientList.InsertColumn(7,_T("User"),LVCFMT_CENTER,110,-1);
|
||||
m_ClientList.InsertColumn(8,_T("Protocol"),LVCFMT_CENTER,110,-1);
|
||||
m_ClientList.InsertColumn(9,_T("Install Time"),LVCFMT_CENTER,140,-1);
|
||||
m_Clientlist.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
||||
m_Clientlist.InsertColumn(0,_T("Computer Name"),LVCFMT_CENTER,130,-1);
|
||||
m_Clientlist.InsertColumn(1,_T("Lan"),LVCFMT_CENTER,120,-1);
|
||||
m_Clientlist.InsertColumn(2,_T("W-Lan"),LVCFMT_CENTER,115,-1);
|
||||
m_Clientlist.InsertColumn(3,_T("OS"),LVCFMT_CENTER,130,-1);
|
||||
m_Clientlist.InsertColumn(4,_T("CPU Frep"),LVCFMT_CENTER,140,-1);
|
||||
m_Clientlist.InsertColumn(5,_T("Memory(MB)"),LVCFMT_CENTER,140,-1);
|
||||
m_Clientlist.InsertColumn(6,_T("Languge"),LVCFMT_CENTER,140,-1);
|
||||
m_Clientlist.InsertColumn(7,_T("User"),LVCFMT_CENTER,110,-1);
|
||||
m_Clientlist.InsertColumn(8,_T("Protocol"),LVCFMT_CENTER,110,-1);
|
||||
m_Clientlist.InsertColumn(9,_T("Install Time"),LVCFMT_CENTER,140,-1);
|
||||
|
||||
m_Imagelist.Create(32,32,ILC_COLOR32|ILC_MASK,2,2);
|
||||
HICON hIcon0 = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON_ONLINE));
|
||||
|
@ -130,9 +136,7 @@ void CHostDlg::InitView()
|
|||
HICON hIcon2 = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON3));
|
||||
m_Imagelist.Add(hIcon2);
|
||||
|
||||
m_ClientList.SetImageList(&m_Imagelist/*,LVSIL_SMALL*/);
|
||||
|
||||
m_ClientList.SetLDbClickCallBack(StartPanel,this);
|
||||
m_Clientlist.SetImageList(&m_Imagelist/*,LVSIL_SMALL*/);
|
||||
}
|
||||
|
||||
BOOL CHostDlg::OnInitDialog()
|
||||
|
@ -146,13 +150,6 @@ BOOL CHostDlg::OnInitDialog()
|
|||
::MessageBox(NULL, _T("初始化工作线程失败!"), _T("Error"), MB_OK | MB_ICONERROR);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
if (! MasterModuleManager::GetInstanceRef().Init())
|
||||
{
|
||||
::MessageBox(NULL, _T("初始化Master模块管理失败"), _T("Error"), MB_OK | MB_ICONERROR);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
SetClientInfoNotifies(ClientInfoNotify,this);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
@ -164,5 +161,5 @@ void CHostDlg::OnSize(UINT nType, int cx, int cy)
|
|||
{
|
||||
CDialogEx::OnSize(nType, cx, cy);
|
||||
m_resizer.Move();
|
||||
// TODO: 在此处添加消息处理程序代码
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "ReportCtrl.h"
|
||||
#include "mfcresize/Resizer.h"
|
||||
#include <map>
|
||||
#include "HostList.h"
|
||||
// CHostDlg ¶Ô»°¿ò
|
||||
|
||||
typedef std::map<CString,CLIENT_INFO> ClientMap;
|
||||
|
@ -21,6 +22,8 @@ public:
|
|||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö
|
||||
|
||||
virtual afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||
|
||||
static void CALLBACK ClientInfoNotify(UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
void CALLBACK ClientInfoNotifyProc(UINT nMsg,CLIENT_INFO* pInfo);
|
||||
|
||||
|
@ -29,7 +32,7 @@ protected:
|
|||
static void StartPanel(CLIENT_INFO& info,LPVOID lpParameter);
|
||||
|
||||
CImageList m_Imagelist;
|
||||
CReportCtrl m_ClientList;
|
||||
CHostList m_Clientlist;
|
||||
CResizer m_resizer;
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
|
@ -40,4 +43,5 @@ private:
|
|||
ClientMap m_clients;
|
||||
CriticalSection m_csClient;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,273 @@
|
|||
#include "StdAfx.h"
|
||||
#include "HostList.h"
|
||||
#include "FilePanelDlg.h"
|
||||
#include "CmdDlg.h"
|
||||
|
||||
CHostList::CHostList(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CHostList::~CHostList(void)
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHostList, CListCtrl)
|
||||
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_LBUTTONDBLCLK()
|
||||
ON_WM_MBUTTONDOWN()
|
||||
ON_WM_MBUTTONDBLCLK()
|
||||
ON_WM_RBUTTONDOWN()
|
||||
ON_WM_RBUTTONDBLCLK()
|
||||
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
|
||||
ON_COMMAND(ID_FILEMANAGER, &CHostList::OnFilemanager)
|
||||
ON_COMMAND(ID_COMMANDER, &CHostList::OnCommander)
|
||||
ON_COMMAND(ID_UNINSTALL, &CHostList::OnUninstall)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CHostList::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
if (GetItemImage(index,0) == 0)
|
||||
{
|
||||
CMenu menu, *pPopup;
|
||||
|
||||
menu.LoadMenu(IDR_MENU_CONTROL);
|
||||
pPopup = menu.GetSubMenu(0);
|
||||
|
||||
CPoint myPoint;
|
||||
ClientToScreen(&myPoint);
|
||||
GetCursorPos(&myPoint);
|
||||
|
||||
pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, myPoint.x, myPoint.y,this);
|
||||
|
||||
}
|
||||
_MouseClkMonitor(WM_RBUTTONDOWN, nFlags, point, FALSE);
|
||||
}
|
||||
|
||||
void CHostList::OnFilemanager()
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (pos < 0)
|
||||
return;
|
||||
|
||||
CLIENT_INFO* info;
|
||||
info = (CLIENT_INFO*)GetItemData(index);
|
||||
|
||||
CFilePanelDlg *dlg = new CFilePanelDlg;
|
||||
dlg->SetClientID(info->clientid);
|
||||
|
||||
dlg->Create(IDD_DIALOG_PANEL);
|
||||
dlg->ShowWindow(TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CHostList::OnCommander()
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (pos < 0)
|
||||
return;
|
||||
|
||||
CLIENT_INFO* info;
|
||||
info = (CLIENT_INFO*)GetItemData(index);
|
||||
|
||||
CCmdDlg* dlg = new CCmdDlg;
|
||||
dlg->InitModule(info->clientid);
|
||||
|
||||
dlg->Create(IDD_DIALOG_CMD);
|
||||
dlg->ShowWindow(TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CHostList::OnUninstall()
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (pos < 0)
|
||||
return;
|
||||
|
||||
CLIENT_INFO* info;
|
||||
info = (CLIENT_INFO*)GetItemData(index);
|
||||
|
||||
MakeClientSelfDestruction(info->clientid);
|
||||
}
|
||||
|
||||
int CHostList::GetInsertGroupsIndex(CString szGourps)
|
||||
{
|
||||
int lineCount = GetItemCount();
|
||||
for (int i = 0; i <= lineCount ; i++)
|
||||
{
|
||||
if (GetItemText(i,0) == szGourps
|
||||
&& GetItemData(i) == 0)
|
||||
{
|
||||
return i+1;
|
||||
}
|
||||
}
|
||||
InsertItem(lineCount,szGourps,2);
|
||||
return lineCount+1;
|
||||
}
|
||||
|
||||
void CHostList::DeleteClientInfo(CLIENT_INFO* pInfo)
|
||||
{
|
||||
int nCount = GetItemCount();
|
||||
|
||||
// GroupMap::iterator it = m_GroupsMap.find(pInfo->groups);
|
||||
// if (it != m_GroupsMap.end())
|
||||
// {
|
||||
// ClientList::iterator cit = it->second.find(pInfo->clientid);
|
||||
//
|
||||
// if (cit != it->second.end())
|
||||
// {
|
||||
// it->second.erase(cit);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (int i = 0 ; i < nCount ; i++)
|
||||
{
|
||||
DWORD dwData = GetItemData(i);
|
||||
if (dwData > 1)
|
||||
{
|
||||
CLIENT_INFO *itemInfo = (CLIENT_INFO*)dwData;
|
||||
if (CString(itemInfo->clientid)
|
||||
== CString(pInfo->clientid))
|
||||
{
|
||||
SetItemColor((int)pInfo,RGB(96,96,96));
|
||||
Update(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CHostList::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
do
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetItemData(index) == 0)
|
||||
{
|
||||
int nImage = GetItemImage(index,0);
|
||||
CString szGName = GetItemText(index,0);
|
||||
|
||||
if (nImage == 1)
|
||||
{
|
||||
SetItemImage(index,0,2);
|
||||
InsertGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetItemImage(index,0,1);
|
||||
DeleteGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
|
||||
}
|
||||
}
|
||||
} while (FALSE);
|
||||
|
||||
_MouseClkMonitor(WM_LBUTTONDBLCLK, nFlags, point, TRUE);
|
||||
}
|
||||
|
||||
BOOL CHostList::AddClientInfo( CLIENT_INFO* pInfo )
|
||||
{
|
||||
CString iplist;
|
||||
IN_ADDR connectIP;
|
||||
connectIP.S_un.S_addr = pInfo->connectIP;
|
||||
|
||||
for (USHORT i = 0; i < pInfo->localIPCount; i++)
|
||||
{
|
||||
IN_ADDR inaddr;
|
||||
inaddr.S_un.S_addr = pInfo->localIPList[i];
|
||||
iplist.AppendFormat(_T("%s,"), CString(inet_ntoa(inaddr)));
|
||||
}
|
||||
iplist.TrimRight(',');
|
||||
|
||||
int nIndex = GetInsertGroupsIndex(pInfo->groups);
|
||||
|
||||
int nImage = GetItemImage(nIndex-1,0);
|
||||
|
||||
CString strCPU;
|
||||
strCPU.Format(_T("%d*%d MHz"),pInfo->cpufrep,pInfo->cpunum);
|
||||
|
||||
if (nImage != 1)
|
||||
{
|
||||
CString memsize;
|
||||
memsize.Format(_T("%d MB"),pInfo->memsize);
|
||||
InsertItem(nIndex,pInfo->computerName);
|
||||
SetItemData(nIndex,(DWORD)pInfo);
|
||||
SetItemText(nIndex,1,iplist);
|
||||
SetItemText(nIndex,2,CString(inet_ntoa(connectIP)));
|
||||
SetItemText(nIndex,3,common::FormatOSDesc(pInfo->windowsVersion,CString(pInfo->vercode), pInfo->bX64));
|
||||
SetItemText(nIndex,4,strCPU);
|
||||
SetItemText(nIndex,5,memsize);
|
||||
SetItemText(nIndex,6,pInfo->lang);
|
||||
SetItemText(nIndex,7,pInfo->priv);
|
||||
SetItemText(nIndex,8,pInfo->proto);
|
||||
SetItemText(nIndex,9,common::FormatSystemTime(pInfo->installTime));
|
||||
}
|
||||
|
||||
GroupMap::iterator it1 = m_GroupsMap.find(pInfo->groups);
|
||||
ClientList list;
|
||||
list.clear();
|
||||
|
||||
if ( it1 != m_GroupsMap.end() )
|
||||
{
|
||||
ClientList::iterator it2 =
|
||||
it1->second.find(pInfo->clientid);
|
||||
|
||||
if (it2 == it1->second.end())
|
||||
{
|
||||
it1->second.insert(MAKE_PAIR(ClientList,pInfo->clientid,pInfo));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list.insert(MAKE_PAIR(ClientList,pInfo->clientid,pInfo));
|
||||
m_GroupsMap.insert(MAKE_PAIR(GroupMap,pInfo->groups,list));
|
||||
}
|
||||
|
||||
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
|
||||
void CHostList::DeleteGroupsClient( int nIndex , ClientList& list )
|
||||
{
|
||||
for (UINT i = 0 ; i < list.size() ; i ++)
|
||||
{
|
||||
DeleteItem(nIndex+1);
|
||||
}
|
||||
}
|
||||
void CHostList::InsertGroupsClient( int nIndex , ClientList& list )
|
||||
{
|
||||
ClientList::iterator it = list.begin();
|
||||
for ( ; it != list.end(); it ++)
|
||||
{
|
||||
int i = AddClientInfo(it->second);
|
||||
|
||||
if (IsAlive(it->second->clientid))
|
||||
SetItemColor((int)it->second,RGB(255,0,0));
|
||||
else
|
||||
SetItemColor((int)it->second,RGB(96,96,96));
|
||||
|
||||
Update(i);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
#include "ReportCtrl.h"
|
||||
|
||||
#include <list>
|
||||
class CHostList : public CReportCtrl
|
||||
{
|
||||
public:
|
||||
CHostList(void);
|
||||
~CHostList(void);
|
||||
|
||||
typedef std::map<tstring,CLIENT_INFO*> ClientList;
|
||||
typedef std::map<tstring,ClientList> GroupMap;
|
||||
|
||||
typedef void (*FnClientCallBack)(CLIENT_INFO& info,LPVOID lpParameter);
|
||||
typedef std::map<CString,BOOL> IsAliveMap;
|
||||
IsAliveMap m_isAliveMap;
|
||||
|
||||
void SetAlive(CString clientid,BOOL is)
|
||||
{
|
||||
m_isAliveMap[clientid] = is;
|
||||
}
|
||||
|
||||
BOOL IsAlive(CString clientid)
|
||||
{
|
||||
if ( m_isAliveMap.find(clientid) != m_isAliveMap.end())
|
||||
return m_isAliveMap[clientid];
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public:
|
||||
//My function
|
||||
int GetInsertGroupsIndex(CString szGourps);
|
||||
BOOL AddClientInfo( CLIENT_INFO* pInfo );
|
||||
void DeleteClientInfo( CLIENT_INFO* pInfo);
|
||||
void InsertGroupsClient( int nIndex , ClientList& list );
|
||||
void DeleteGroupsClient( int nIndex , ClientList& list );
|
||||
|
||||
virtual afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
GroupMap m_GroupsMap;
|
||||
|
||||
public:
|
||||
afx_msg void OnFilemanager();
|
||||
afx_msg void OnCommander();
|
||||
afx_msg void OnUninstall();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
// InstallDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Trochilus.h"
|
||||
#include "InstallDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CInstallDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CInstallDlg, CDialogEx)
|
||||
|
||||
CInstallDlg::CInstallDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(CInstallDlg::IDD, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CInstallDlg::~CInstallDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CInstallDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_PROGRESS_INSTALL, m_insProgress);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CInstallDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_INSTALL, &CInstallDlg::OnBnClickedButtonInstall)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CInstallDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL CInstallDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
m_insProgress.ShowWindow(SW_HIDE);
|
||||
|
||||
m_CheckRepeat.Init(CheckModule,this,_T("checkmodule"),0,1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
DWORD WINAPI CInstallDlg::CheckModule(LPVOID lpParameter)
|
||||
{
|
||||
CInstallDlg* lpDlg = (CInstallDlg*)lpParameter;
|
||||
return lpDlg->CheckModuleProc();
|
||||
}
|
||||
|
||||
DWORD WINAPI CInstallDlg::CheckModuleProc()
|
||||
{
|
||||
MODULE_INST_STATUS status;
|
||||
UINT progress;
|
||||
|
||||
QueryModuleInstallStatus(m_clientid,m_modname,&status,&progress);
|
||||
|
||||
if (status == MODULESTATUS_INSTALLING)
|
||||
{
|
||||
m_insProgress.SetPos(progress);
|
||||
}
|
||||
else if(status == MODULESTATUS_INSTALLED)
|
||||
{
|
||||
ClientControlPanelManager::GetInstanceRef().HandleModuleMsg(m_clientid,MODULE_MSG_INSTALLED,m_modname.GetBuffer(),NULL);
|
||||
m_CheckRepeat.Stop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CInstallDlg::OnBnClickedButtonInstall()
|
||||
{
|
||||
if (InstallClientModule(m_clientid,m_modname))
|
||||
{
|
||||
m_insProgress.ShowWindow(SW_SHOW);
|
||||
|
||||
m_CheckRepeat.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox(_T("Request install module faild!"));
|
||||
}
|
||||
}
|
||||
|
||||
void CInstallDlg::Init(LPCTSTR clientid,LPCTSTR ModuleName)
|
||||
{
|
||||
m_clientid = clientid;
|
||||
m_modname = ModuleName;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
|
||||
|
||||
// CInstallDlg 对话框
|
||||
|
||||
class CInstallDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CInstallDlg)
|
||||
|
||||
public:
|
||||
CInstallDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CInstallDlg();
|
||||
|
||||
void Init(LPCTSTR clientid,LPCTSTR ModuleName);
|
||||
|
||||
// 对话框数据
|
||||
enum { IDD = IDD_DIALOG_INSTALL };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
//检查模块状况
|
||||
static DWORD WINAPI CheckModule(LPVOID lpParameter);
|
||||
DWORD WINAPI CheckModuleProc();
|
||||
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
CProgressCtrl m_insProgress;
|
||||
|
||||
CString m_clientid;
|
||||
CString m_modname;
|
||||
|
||||
RepeatTask m_CheckRepeat;
|
||||
afx_msg void OnBnClickedButtonInstall();
|
||||
};
|
|
@ -1,155 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "MasterModuleManager.h"
|
||||
|
||||
MasterModuleManager::MasterModuleManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MasterModuleManager::~MasterModuleManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOL MasterModuleManager::Init()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MasterModuleManager::Deinit()
|
||||
{
|
||||
}
|
||||
|
||||
// BOOL MasterModuleManager::CallModuleFunction( LPCTSTR moduleName, LPCTSTR funcname, LPCTSTR clientid, LPCTSTR argument, CString& result )
|
||||
// {
|
||||
// CString modname(moduleName);
|
||||
// modname.MakeLower();
|
||||
// modname.Trim();
|
||||
//
|
||||
// //查找对应的模块
|
||||
// BOOL bFoundModule = FALSE;
|
||||
// MASTER_MODULE masterModule;
|
||||
// m_mapSection.Enter();
|
||||
// {
|
||||
// MasterModuleMap::iterator iter = m_map.find(modname);
|
||||
//
|
||||
// //如果map里没有这个模块,则尝试加载
|
||||
// if (iter != m_map.end())
|
||||
// {
|
||||
// masterModule = iter->second;
|
||||
// bFoundModule = TRUE;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CString dllpath;
|
||||
// dllpath.Format(_T("%s%s.dll"), getBinFilePath(), modname);
|
||||
// MASTER_MODULE mod;
|
||||
// mod.hMod = ::LoadLibrary(dllpath);
|
||||
// if (NULL != mod.hMod)
|
||||
// {
|
||||
// COMMANDER_API_LIST apilist;
|
||||
// // apilist.fnCallJs = old_CallApi;
|
||||
// mod.fnInitMasterModule = (FnInitMasterModule) ::GetProcAddress(mod.hMod, "InitMasterModule");
|
||||
// mod.fnDeinitMasterModule = (FnDeinitMasterModule) ::GetProcAddress(mod.hMod, "DeinitMasterModule");
|
||||
// mod.fnQueryWincAPI = (FnQueryWincAPI) ::GetProcAddress(mod.hMod, "QueryWincAPI");
|
||||
// if (mod.fnInitMasterModule != NULL
|
||||
// && mod.fnDeinitMasterModule != NULL
|
||||
// && mod.fnQueryWincAPI != NULL)
|
||||
// {
|
||||
// BOOL bInitRet = mod.fnInitMasterModule(&apilist);
|
||||
// if (bInitRet)
|
||||
// {
|
||||
// m_map.insert(MasterModuleMap::value_type(modname, mod));
|
||||
// masterModule = mod;
|
||||
// bFoundModule = TRUE;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// errorLog(_T("init master module[%s] failed"), dllpath);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// errorLogE(_T("load %s failed."), dllpath);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// m_mapSection.Leave();
|
||||
//
|
||||
// if (! bFoundModule)
|
||||
// {
|
||||
// errorLog(_T("Can not find module[%s]"), modname);
|
||||
// return FALSE;
|
||||
// }
|
||||
//
|
||||
// //查询该模块是否提供了该回调函数
|
||||
// FnWincCallback fnCallback = NULL;
|
||||
// LPVOID lpParameter = NULL;
|
||||
// if (! masterModule.fnQueryWincAPI(funcname, &fnCallback, &lpParameter))
|
||||
// {
|
||||
// errorLog(_T("mod[%s] has no function named[%s]"), modname, funcname);
|
||||
// return FALSE;
|
||||
// }
|
||||
//
|
||||
// MyString myResult;
|
||||
// if (! fnCallback(clientid, argument, lpParameter, &myResult))
|
||||
// {
|
||||
// errorLog(_T("call [%s][%s] failed"), modname, funcname);
|
||||
// return FALSE;
|
||||
// }
|
||||
//
|
||||
// result = (LPCTSTR) myResult;
|
||||
//
|
||||
// return TRUE;
|
||||
// }
|
||||
|
||||
void MasterModuleManager::GetModuleNames( TStringVector& names )
|
||||
{
|
||||
}
|
||||
|
||||
BOOL MasterModuleManager::CheckModuleInfo(MODULE_INFO& info)
|
||||
{
|
||||
return info.alloc && info.deinit && info.free && info.handler && info.init;
|
||||
}
|
||||
void MasterModuleManager::LoadAllModules( ModuleMap& moduleMap )
|
||||
{
|
||||
WCHAR szPath[MAX_PATH] = {0};
|
||||
|
||||
getBinFilePath(szPath,MAX_PATH);
|
||||
|
||||
CString strPath = szPath;
|
||||
|
||||
CString strFind = strPath +_T("mod*.dll");
|
||||
|
||||
WIN32_FIND_DATA fData;
|
||||
HANDLE hFind = FindFirstFile(strFind,&fData);;
|
||||
do
|
||||
{
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
CString strTemp = strPath + fData.cFileName;
|
||||
|
||||
HMODULE hMod = LoadLibrary(strTemp);
|
||||
|
||||
MODULE_INFO info = {0};
|
||||
|
||||
info.isInside = FALSE;
|
||||
|
||||
info.alloc = (fnAllocWindow)GetProcAddress(hMod,"AllocWindow");
|
||||
info.free = (fnFreeWindow)GetProcAddress(hMod,"FreeWindow");
|
||||
info.init = (fnInitModule)GetProcAddress(hMod,"InitModule");
|
||||
info.deinit = (fnDeinitModule)GetProcAddress(hMod,"DeinitModule");
|
||||
info.handler = (fnHandleMsg)GetProcAddress(hMod,"HandleMsg");
|
||||
info.getname = (fnGetDisplayName)GetProcAddress(hMod,"GetModName");
|
||||
|
||||
if (CheckModuleInfo(info))
|
||||
{
|
||||
moduleMap.insert(MAKE_PAIR(ModuleMap,moduleMap.size(),info));
|
||||
}
|
||||
}
|
||||
while(FindNextFile(hFind,&fData));
|
||||
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#pragma once
|
||||
#include <map>
|
||||
#include "MasterModuleInterface.h"
|
||||
#include "ClientControlPanelManager.h"
|
||||
|
||||
class MasterModuleManager
|
||||
{
|
||||
DECLARE_SINGLETON(MasterModuleManager);
|
||||
public:
|
||||
void GetModuleNames(TStringVector& names);
|
||||
void LoadAllModules(ModuleMap& moduleMap);
|
||||
void GetModuleWndClass();
|
||||
|
||||
private:
|
||||
BOOL CheckModuleInfo(MODULE_INFO& info);
|
||||
CriticalSection m_mapSection;
|
||||
ModuleMap m_moduleMap;
|
||||
};
|
|
@ -1,345 +0,0 @@
|
|||
// PanelDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Trochilus.h"
|
||||
#include "PanelDlg.h"
|
||||
#include "InstallDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
// CPanelDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CPanelDlg, CDialogEx)
|
||||
|
||||
CPanelDlg::CPanelDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(CPanelDlg::IDD, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CPanelDlg::~CPanelDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CPanelDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_TAB_PANEL, m_TabCtrl);
|
||||
DDX_Control(pDX, IDC_LIST_MSG, m_msgList);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPanelDlg, CDialogEx)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_PANEL, &CPanelDlg::OnTcnSelchangeTabPanel)
|
||||
ON_WM_CLOSE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CPanelDlg 消息处理程序
|
||||
void CPanelDlg::InitInsideModule()
|
||||
{
|
||||
CRect rs;
|
||||
m_TabCtrl.GetClientRect(&rs);
|
||||
rs.top += 21;
|
||||
|
||||
CFileMgrDlg* FileDlg = new CFileMgrDlg;
|
||||
CTransferDlg* TransDlg = new CTransferDlg;
|
||||
CCmdDlg* CmdDlg = new CCmdDlg;
|
||||
|
||||
m_MemList.push_back(FileDlg);
|
||||
m_MemList.push_back(TransDlg);
|
||||
m_MemList.push_back(CmdDlg);
|
||||
|
||||
MODULE_INFO fileInfo = {0};
|
||||
MODULE_INFO transInfo = {0};;
|
||||
MODULE_INFO cmdInfo = {0};;
|
||||
|
||||
fileInfo.lpParameter = (CDialogEx*)FileDlg;
|
||||
fileInfo.isInside = TRUE;
|
||||
fileInfo.inside_init = FileDlg->InitModule;
|
||||
fileInfo.handler = FileDlg->HandleModuleMsg;
|
||||
|
||||
transInfo.lpParameter = (CDialogEx*)TransDlg;
|
||||
transInfo.isInside = TRUE;
|
||||
transInfo.inside_init = TransDlg->InitModule;
|
||||
transInfo.handler = TransDlg->HandleModuleMsg;
|
||||
|
||||
cmdInfo.lpParameter = (CDialogEx*)CmdDlg;
|
||||
cmdInfo.isInside = TRUE;
|
||||
cmdInfo.inside_init = CmdDlg->InitModule;
|
||||
cmdInfo.handler = CmdDlg->HandleModuleMsg;
|
||||
|
||||
m_TabCtrl.InsertItem(0,_T("File Manager"));
|
||||
m_TabCtrl.InsertItem(1,_T("Transfer"));
|
||||
m_TabCtrl.InsertItem(2,_T("Shell"));
|
||||
|
||||
m_moduleMap.insert(MAKE_PAIR(ModuleMap,0,fileInfo));
|
||||
m_moduleMap.insert(MAKE_PAIR(ModuleMap,1,transInfo));
|
||||
m_moduleMap.insert(MAKE_PAIR(ModuleMap,2,cmdInfo));
|
||||
|
||||
CLIENT_INFO info;
|
||||
GetClientInfo(m_clientid,&info);
|
||||
FnModuleNotifyProc func = \
|
||||
ClientControlPanelManager::GetInstanceRef().HandleModuleMsg;
|
||||
|
||||
ModuleMap::iterator it = m_moduleMap.begin();
|
||||
|
||||
for (; it != m_moduleMap.end() ; it++)
|
||||
{
|
||||
MODULE_INFO& modinfo = it->second;
|
||||
|
||||
if (it->second.isInside)
|
||||
modinfo.inside_init(m_clientid,info,func,modinfo.lpParameter);
|
||||
}
|
||||
|
||||
FileDlg->Create(IDD_DIALOG_FILE);
|
||||
TransDlg->Create(IDD_DIALOG_TRANSFER);
|
||||
CmdDlg->Create(IDD_DIALOG_CMD);
|
||||
|
||||
CWnd* pWnd = CWnd::FromHandle(m_TabCtrl.GetSafeHwnd());
|
||||
|
||||
FileDlg->SetParent(pWnd);
|
||||
TransDlg->SetParent(pWnd);
|
||||
CmdDlg->SetParent(pWnd);
|
||||
|
||||
it = m_moduleMap.begin();
|
||||
|
||||
for (; it != m_moduleMap.end() ; it++)
|
||||
{
|
||||
MODULE_INFO& modinfo = it->second;
|
||||
modinfo.hWnd = ((CDialogEx*)modinfo.lpParameter)->GetSafeHwnd();
|
||||
}
|
||||
|
||||
TransDlg->MoveWindow(&rs);
|
||||
FileDlg->MoveWindow(&rs);
|
||||
CmdDlg->MoveWindow(&rs);
|
||||
}
|
||||
|
||||
void CPanelDlg::InitOutsideModule()
|
||||
{
|
||||
HWND hModule = 0;
|
||||
|
||||
//加载模块
|
||||
MasterModuleManager::GetInstanceRef().LoadAllModules(m_moduleMap);
|
||||
|
||||
//初始化模块信息
|
||||
INIT_INFO info;
|
||||
|
||||
lstrcpy(info.clientid,m_clientid);
|
||||
|
||||
CLIENT_INFO clientInfo;
|
||||
GetClientInfo(m_clientid,&clientInfo);
|
||||
|
||||
info.info = clientInfo;
|
||||
|
||||
CRect rs;
|
||||
m_TabCtrl.GetClientRect(&rs);
|
||||
rs.top += 21;
|
||||
|
||||
//枚举添加模块内容
|
||||
ModuleMap::iterator it = m_moduleMap.begin();
|
||||
|
||||
for (; it != m_moduleMap.end() ; it++)
|
||||
{
|
||||
MODULE_INFO& modinfo = it->second;
|
||||
|
||||
LPVOID lpParameter;
|
||||
|
||||
//是否是内置模块
|
||||
if (!it->second.isInside)
|
||||
{
|
||||
modinfo.init();
|
||||
it->second.alloc(hModule,m_TabCtrl.GetSafeHwnd(),info,&lpParameter);
|
||||
(CWnd::FromHandle(hModule))->MoveWindow(rs);
|
||||
it->second.hTemp = hModule;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
//判断模块是否安装
|
||||
UINT progress;
|
||||
MODULE_INST_STATUS status;
|
||||
|
||||
QueryModuleInstallStatus(m_clientid,it->second.getname(),&status,&progress);
|
||||
|
||||
if( status == MODULESTATUS_UNINSTALLED )
|
||||
{
|
||||
CInstallDlg* dlg = new CInstallDlg;
|
||||
dlg->Init(m_clientid,it->second.getname());
|
||||
dlg->Create(IDD_DIALOG_INSTALL,CWnd::FromHandle(m_TabCtrl.GetSafeHwnd()));
|
||||
hModule = dlg->GetSafeHwnd();
|
||||
it->second.hWnd = hModule;
|
||||
}
|
||||
|
||||
if ( status == MODULESTATUS_INSTALLED )
|
||||
{
|
||||
it->second.hWnd = hModule;
|
||||
}
|
||||
|
||||
(CWnd::FromHandle(hModule))->MoveWindow(rs);
|
||||
|
||||
CString DisplayName = CString(it->second.getname());
|
||||
DisplayName.Replace(_T("Mod"),_T(""));
|
||||
|
||||
m_TabCtrl.InsertItem(m_TabCtrl.GetItemCount(),DisplayName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CPanelDlg::InitData()
|
||||
{
|
||||
InitInsideModule();
|
||||
InitOutsideModule();
|
||||
|
||||
::ShowWindow(m_moduleMap[0].hWnd,SW_SHOW);
|
||||
}
|
||||
|
||||
void CPanelDlg::InitView()
|
||||
{
|
||||
m_ImageList.Create(16,16,ILC_COLOR8|ILC_MASK,2,1);
|
||||
|
||||
m_msgList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
||||
m_msgList.InsertColumn(0,_T("Date"),LVCFMT_CENTER,230,-1);
|
||||
m_msgList.InsertColumn(1,_T("Type"),LVCFMT_CENTER,150,-1);
|
||||
m_msgList.InsertColumn(2,_T("Content"),LVCFMT_CENTER,350,-1);
|
||||
m_msgList.SetImageList(&m_ImageList,LVSIL_SMALL);
|
||||
|
||||
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_NOTIFY));
|
||||
|
||||
CString strTitle;
|
||||
CLIENT_INFO info;
|
||||
|
||||
GetClientInfo(m_clientid,&info);
|
||||
|
||||
IN_ADDR connectIP;
|
||||
connectIP.S_un.S_addr = info.connectIP;
|
||||
|
||||
strTitle.Format(_T("Control Panel [%s][%s]"),info.computerName,CString(inet_ntoa(connectIP)).GetBuffer());
|
||||
|
||||
SetWindowText(strTitle);
|
||||
}
|
||||
|
||||
BOOL CPanelDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
InitView();
|
||||
InitData();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CPanelDlg::HandleMsgNotify(UINT nType, LPCTSTR lpContext)
|
||||
{
|
||||
SYSTEMTIME sysTime;
|
||||
|
||||
GetLocalTime(&sysTime);
|
||||
|
||||
CString strTime = common::FormatSystemTime(sysTime);
|
||||
CString strStatus;
|
||||
|
||||
switch(nType)
|
||||
{
|
||||
case MODULE_TYPE_ERROR:
|
||||
strStatus = _T("Error");
|
||||
break;
|
||||
case MODULE_TYPE_INFO:
|
||||
strStatus = _T("Info");
|
||||
break;
|
||||
case MODULE_TYPE_WARNING:
|
||||
strStatus = _T("Warning");
|
||||
break;
|
||||
}
|
||||
m_msgList.InsertItem(0,strTime,0);
|
||||
m_msgList.SetItemText(0,1,strStatus);
|
||||
m_msgList.SetItemText(0,2,lpContext);
|
||||
}
|
||||
|
||||
void CPanelDlg::HandleModuleMsg(UINT nMsg, LPVOID lpContext, LPVOID lpParameter)
|
||||
{
|
||||
//处理提示信息
|
||||
if (nMsg == MODULE_MSG_NOTIFYMSG)
|
||||
{
|
||||
HandleMsgNotify((UINT)lpParameter,(LPCTSTR)lpContext);
|
||||
return;
|
||||
}
|
||||
|
||||
//处理模块安装
|
||||
if (nMsg == MODULE_MSG_INSTALLED)
|
||||
{
|
||||
CRect rs;
|
||||
m_TabCtrl.GetClientRect(&rs);
|
||||
rs.top += 21;
|
||||
|
||||
//初始化模块信息
|
||||
INIT_INFO info;
|
||||
|
||||
lstrcpy(info.clientid,m_clientid);
|
||||
|
||||
CLIENT_INFO clientInfo;
|
||||
GetClientInfo(m_clientid,&clientInfo);
|
||||
|
||||
info.info = clientInfo;
|
||||
|
||||
ModuleMap::iterator it = m_moduleMap.begin();
|
||||
for ( ; it != m_moduleMap.end() ; it++)
|
||||
{
|
||||
if (!it->second.isInside)
|
||||
{
|
||||
if (CString(it->second.getname()) == (LPCTSTR)lpContext)
|
||||
{
|
||||
if (m_TabCtrl.GetCurSel() == it->first)
|
||||
{
|
||||
::ShowWindow(it->second.hWnd,SW_HIDE);
|
||||
::ShowWindow(it->second.hTemp,SW_SHOW);
|
||||
}
|
||||
it->second.hWnd = it->second.hTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//分发模块处理
|
||||
m_csModuleMap.Enter();
|
||||
{
|
||||
ModuleMap::iterator it = m_moduleMap.begin();
|
||||
for ( ; it != m_moduleMap.end(); it ++)
|
||||
{
|
||||
MODULE_INFO& info = it->second;
|
||||
info.handler(m_clientid,nMsg,lpContext,info.lpParameter);
|
||||
}
|
||||
}
|
||||
m_csModuleMap.Leave();
|
||||
}
|
||||
|
||||
void CPanelDlg::OnTcnSelchangeTabPanel(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
{
|
||||
int nSel = m_TabCtrl.GetCurSel();
|
||||
|
||||
ModuleMap::iterator it = m_moduleMap.begin();
|
||||
for (; it != m_moduleMap.end() ; it++)
|
||||
{
|
||||
if (it->first == nSel)
|
||||
{
|
||||
::ShowWindow(it->second.hWnd,SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
::ShowWindow(it->second.hWnd,SW_HIDE);
|
||||
}
|
||||
}
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CPanelDlg::OnClose()
|
||||
{
|
||||
CDialogEx::OnClose();
|
||||
|
||||
NewMemList::iterator it = m_MemList.begin();
|
||||
|
||||
for (; it != m_MemList.end(); it++)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "ReportCtrl.h"
|
||||
#include <afxtempl.h>
|
||||
#include "resource.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -166,8 +167,7 @@ int _ITEM_COMPARE_FUNCS::_DateCompare(const COleDateTime& date1, const COleDateT
|
|||
// CReportCtrl Implementation
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
CReportCtrl::CReportCtrl():
|
||||
m_pWndEdit(NULL),
|
||||
m_lpDbcFunc(NULL)
|
||||
m_pWndEdit(NULL)
|
||||
{
|
||||
m_pWndEdit = new CEdit;
|
||||
VERIFY(m_pWndEdit != NULL);
|
||||
|
@ -204,7 +204,6 @@ BEGIN_MESSAGE_MAP(CReportCtrl, CListCtrl)
|
|||
ON_WM_RBUTTONDBLCLK()
|
||||
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
|
||||
//}}AFX_MSG_MAP
|
||||
ON_NOTIFY_REFLECT(NM_RDBLCLK, &CReportCtrl::OnNMRDblclk)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -248,181 +247,8 @@ void CReportCtrl::OnLButtonDown(UINT nFlags, CPoint point)
|
|||
_MouseClkMonitor(WM_LBUTTONDOWN, nFlags, point, TRUE);
|
||||
}
|
||||
|
||||
int CReportCtrl::GetInsertGroupsIndex(CString szGourps)
|
||||
{
|
||||
int lineCount = GetItemCount();
|
||||
for (int i = 0; i <= lineCount ; i++)
|
||||
{
|
||||
if (GetItemText(i,0) == szGourps
|
||||
&& GetItemData(i) == 0)
|
||||
{
|
||||
return i+1;
|
||||
}
|
||||
}
|
||||
InsertItem(lineCount,szGourps,2);
|
||||
return lineCount+1;
|
||||
}
|
||||
|
||||
void CReportCtrl::DeleteClientInfo(CLIENT_INFO* pInfo)
|
||||
{
|
||||
int nCount = GetItemCount();
|
||||
|
||||
// GroupMap::iterator it = m_GroupsMap.find(pInfo->groups);
|
||||
// if (it != m_GroupsMap.end())
|
||||
// {
|
||||
// ClientList::iterator cit = it->second.find(pInfo->clientid);
|
||||
//
|
||||
// if (cit != it->second.end())
|
||||
// {
|
||||
// it->second.erase(cit);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (int i = 0 ; i < nCount ; i++)
|
||||
{
|
||||
DWORD dwData = GetItemData(i);
|
||||
if (dwData > 1)
|
||||
{
|
||||
CLIENT_INFO *itemInfo = (CLIENT_INFO*)dwData;
|
||||
if (CString(itemInfo->clientid)
|
||||
== CString(pInfo->clientid))
|
||||
{
|
||||
SetItemColor((int)pInfo,RGB(96,96,96));
|
||||
Update(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CReportCtrl::AddClientInfo( CLIENT_INFO* pInfo )
|
||||
{
|
||||
CString iplist;
|
||||
IN_ADDR connectIP;
|
||||
connectIP.S_un.S_addr = pInfo->connectIP;
|
||||
|
||||
for (USHORT i = 0; i < pInfo->localIPCount; i++)
|
||||
{
|
||||
IN_ADDR inaddr;
|
||||
inaddr.S_un.S_addr = pInfo->localIPList[i];
|
||||
iplist.AppendFormat(_T("%s,"), CString(inet_ntoa(inaddr)));
|
||||
}
|
||||
iplist.TrimRight(',');
|
||||
|
||||
int nIndex = GetInsertGroupsIndex(pInfo->groups);
|
||||
|
||||
int nImage = GetItemImage(nIndex-1,0);
|
||||
|
||||
CString strCPU;
|
||||
strCPU.Format(_T("%d*%d MHz"),pInfo->cpufrep,pInfo->cpunum);
|
||||
|
||||
if (nImage != 1)
|
||||
{
|
||||
CString memsize;
|
||||
memsize.Format(_T("%d MB"),pInfo->memsize);
|
||||
InsertItem(nIndex,pInfo->computerName);
|
||||
SetItemData(nIndex,(DWORD)pInfo);
|
||||
SetItemText(nIndex,1,iplist);
|
||||
SetItemText(nIndex,2,CString(inet_ntoa(connectIP)));
|
||||
SetItemText(nIndex,3,common::FormatOSDesc(pInfo->windowsVersion,CString(pInfo->vercode), pInfo->bX64));
|
||||
SetItemText(nIndex,4,strCPU);
|
||||
SetItemText(nIndex,5,memsize);
|
||||
SetItemText(nIndex,6,pInfo->lang);
|
||||
SetItemText(nIndex,7,pInfo->priv);
|
||||
SetItemText(nIndex,8,pInfo->proto);
|
||||
SetItemText(nIndex,9,common::FormatSystemTime(pInfo->installTime));
|
||||
}
|
||||
|
||||
GroupMap::iterator it1 = m_GroupsMap.find(pInfo->groups);
|
||||
ClientList list;
|
||||
list.clear();
|
||||
|
||||
if ( it1 != m_GroupsMap.end() )
|
||||
{
|
||||
ClientList::iterator it2 =
|
||||
it1->second.find(pInfo->clientid);
|
||||
|
||||
if (it2 == it1->second.end())
|
||||
{
|
||||
it1->second.insert(MAKE_PAIR(ClientList,pInfo->clientid,pInfo));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list.insert(MAKE_PAIR(ClientList,pInfo->clientid,pInfo));
|
||||
m_GroupsMap.insert(MAKE_PAIR(GroupMap,pInfo->groups,list));
|
||||
}
|
||||
|
||||
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
|
||||
void CReportCtrl::DeleteGroupsClient( int nIndex , ClientList& list )
|
||||
{
|
||||
for (UINT i = 0 ; i < list.size() ; i ++)
|
||||
{
|
||||
DeleteItem(nIndex+1);
|
||||
}
|
||||
}
|
||||
void CReportCtrl::InsertGroupsClient( int nIndex , ClientList& list )
|
||||
{
|
||||
ClientList::iterator it = list.begin();
|
||||
for ( ; it != list.end(); it ++)
|
||||
{
|
||||
int i = AddClientInfo(it->second);
|
||||
|
||||
if (IsAlive(it->second->clientid))
|
||||
SetItemColor((int)it->second,RGB(255,0,0));
|
||||
else
|
||||
SetItemColor((int)it->second,RGB(96,96,96));
|
||||
|
||||
Update(i);
|
||||
}
|
||||
}
|
||||
void CReportCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
do
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetItemImage(index,0) == 0)
|
||||
{
|
||||
CLIENT_INFO* info;
|
||||
info = (CLIENT_INFO*)GetItemData(index);
|
||||
|
||||
if (IsAlive(info->clientid))
|
||||
{
|
||||
m_lpDbcFunc(*info,m_lpParameter);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetItemData(index) == 0)
|
||||
{
|
||||
int nImage = GetItemImage(index,0);
|
||||
CString szGName = GetItemText(index,0);
|
||||
|
||||
if (nImage == 1)
|
||||
{
|
||||
SetItemImage(index,0,2);
|
||||
InsertGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetItemImage(index,0,1);
|
||||
DeleteGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
|
||||
}
|
||||
}
|
||||
} while (FALSE);
|
||||
|
||||
{
|
||||
_MouseClkMonitor(WM_LBUTTONDBLCLK, nFlags, point, TRUE);
|
||||
}
|
||||
|
||||
|
@ -440,33 +266,11 @@ void CReportCtrl::OnMButtonDblClk(UINT nFlags, CPoint point)
|
|||
|
||||
void CReportCtrl::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
_MouseClkMonitor(WM_RBUTTONDOWN, nFlags, point, FALSE);
|
||||
}
|
||||
|
||||
void CReportCtrl::OnRButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
do
|
||||
{
|
||||
POSITION pos = GetFirstSelectedItemPosition();
|
||||
int index = GetNextSelectedItem(pos);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetItemImage(index,0) == 0)
|
||||
{
|
||||
CLIENT_INFO* info;
|
||||
info = (CLIENT_INFO*)GetItemData(index);
|
||||
if (IsAlive(info->clientid))
|
||||
MakeClientSelfDestruction(info->clientid);
|
||||
break;
|
||||
}
|
||||
|
||||
} while (FALSE);
|
||||
|
||||
_MouseClkMonitor(WM_RBUTTONDBLCLK, nFlags, point, FALSE);
|
||||
}
|
||||
|
||||
|
@ -1998,11 +1802,3 @@ void CReportCtrl::_QuickSortRecursive(int* pArr, int nLow, int nHigh)
|
|||
if (j < nHigh)
|
||||
_QuickSortRecursive(pArr,j,nHigh);
|
||||
}
|
||||
|
||||
|
||||
void CReportCtrl::OnNMRDblclk(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
{
|
||||
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
*pResult = 0;
|
||||
}
|
||||
|
|
|
@ -89,12 +89,7 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// The CReportCtrl Class Definition
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include <list>
|
||||
typedef std::map<tstring,CLIENT_INFO*> ClientList;
|
||||
typedef std::map<tstring,ClientList> GroupMap;
|
||||
|
||||
typedef void (*FnClientCallBack)(CLIENT_INFO& info,LPVOID lpParameter);
|
||||
typedef std::map<CString,BOOL> IsAliveMap;
|
||||
class CReportCtrl : public CListCtrl
|
||||
{
|
||||
public:
|
||||
|
@ -111,22 +106,6 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
virtual BOOL Create(CWnd* pParentWnd, UINT nID, LPCRECT lpRect = NULL, DWORD dwStyle = WS_BORDER | WS_TABSTOP);
|
||||
|
||||
//My function
|
||||
int GetInsertGroupsIndex(CString szGourps);
|
||||
BOOL AddClientInfo( CLIENT_INFO* pInfo );
|
||||
void DeleteClientInfo( CLIENT_INFO* pInfo);
|
||||
void InsertGroupsClient( int nIndex , ClientList& list );
|
||||
void DeleteGroupsClient( int nIndex , ClientList& list );
|
||||
void SetLDbClickCallBack(FnClientCallBack lpFunc,LPVOID lpParameter)
|
||||
{
|
||||
m_lpDbcFunc = lpFunc;
|
||||
m_lpParameter = lpParameter;
|
||||
return;
|
||||
}
|
||||
|
||||
FnClientCallBack m_lpDbcFunc;
|
||||
LPVOID m_lpParameter;
|
||||
GroupMap m_GroupsMap;
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Column Header attributes
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
@ -282,8 +261,6 @@ protected:
|
|||
int m_nSortCol; // The sorted column, -1 if none
|
||||
BOOL m_bSortAscending; // Is sort ascending?
|
||||
|
||||
IsAliveMap m_isAliveMap;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Wizard Generated Stuff
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -298,38 +275,23 @@ protected:
|
|||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
public:
|
||||
void SetAlive(CString clientid,BOOL is)
|
||||
{
|
||||
m_isAliveMap[clientid] = is;
|
||||
}
|
||||
|
||||
BOOL IsAlive(CString clientid)
|
||||
{
|
||||
if ( m_isAliveMap.find(clientid) != m_isAliveMap.end())
|
||||
return m_isAliveMap[clientid];
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//{{AFX_MSG(CReportCtrl)
|
||||
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
||||
afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
virtual afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
virtual afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
virtual afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
virtual afx_msg void OnDestroy();
|
||||
virtual afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnNMRDblclk(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
Binary file not shown.
|
@ -78,8 +78,6 @@ BOOL CTrochilusApp::InitInstance()
|
|||
// 例如修改为公司或组织名
|
||||
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
|
||||
|
||||
SetModuleCallBack(ClientControlPanelManager::GetInstanceRef().HandleModuleMsg);
|
||||
|
||||
CTrochilusDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
|
|
Binary file not shown.
|
@ -157,18 +157,16 @@
|
|||
<ClInclude Include="..\..\..\base\include\tstring.h" />
|
||||
<ClInclude Include="..\..\pub\IModule.h" />
|
||||
<ClInclude Include="..\..\pub\ModuleMessage.h" />
|
||||
<ClInclude Include="ClientControlPanelManager.h" />
|
||||
<ClInclude Include="CmdDlg.h" />
|
||||
<ClInclude Include="ColorProgressCtrl.h" />
|
||||
<ClInclude Include="common.h" />
|
||||
<ClInclude Include="DownDlg.h" />
|
||||
<ClInclude Include="FileMgrDlg.h" />
|
||||
<ClInclude Include="HostDlg.h" />
|
||||
<ClInclude Include="HostList.h" />
|
||||
<ClInclude Include="IconLoader.h" />
|
||||
<ClInclude Include="InstallDlg.h" />
|
||||
<ClInclude Include="ListenDlg.h" />
|
||||
<ClInclude Include="MasterModuleManager.h" />
|
||||
<ClInclude Include="PanelDlg.h" />
|
||||
<ClInclude Include="FilePanelDlg.h" />
|
||||
<ClInclude Include="ProgressListCtrl.h" />
|
||||
<ClInclude Include="ReportCtrl.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
|
@ -187,18 +185,16 @@
|
|||
<ClCompile Include="..\..\..\base\include\thread\RepeatTask.cpp" />
|
||||
<ClCompile Include="..\..\..\base\include\thread\ThreadArray.cpp" />
|
||||
<ClCompile Include="..\..\..\base\include\tstring.cpp" />
|
||||
<ClCompile Include="ClientControlPanelManager.cpp" />
|
||||
<ClCompile Include="CmdDlg.cpp" />
|
||||
<ClCompile Include="ColorProgressCtrl.cpp" />
|
||||
<ClCompile Include="common.cpp" />
|
||||
<ClCompile Include="DownDlg.cpp" />
|
||||
<ClCompile Include="FileMgrDlg.cpp" />
|
||||
<ClCompile Include="HostDlg.cpp" />
|
||||
<ClCompile Include="HostList.cpp" />
|
||||
<ClCompile Include="IconLoader.cpp" />
|
||||
<ClCompile Include="InstallDlg.cpp" />
|
||||
<ClCompile Include="ListenDlg.cpp" />
|
||||
<ClCompile Include="MasterModuleManager.cpp" />
|
||||
<ClCompile Include="PanelDlg.cpp" />
|
||||
<ClCompile Include="FilePanelDlg.cpp" />
|
||||
<ClCompile Include="ProgressListCtrl.cpp" />
|
||||
<ClCompile Include="ReportCtrl.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
|
@ -102,15 +102,6 @@
|
|||
<ClInclude Include="common.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PanelDlg.h">
|
||||
<Filter>dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MasterModuleManager.h">
|
||||
<Filter>control</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ClientControlPanelManager.h">
|
||||
<Filter>control</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\base\include\json\autolink.h">
|
||||
<Filter>json</Filter>
|
||||
</ClInclude>
|
||||
|
@ -228,9 +219,6 @@
|
|||
<ClInclude Include="..\..\pub\ModuleMessage.h">
|
||||
<Filter>control</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InstallDlg.h">
|
||||
<Filter>dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\base\include\mfcresize\Resizer.h">
|
||||
<Filter>resize</Filter>
|
||||
</ClInclude>
|
||||
|
@ -240,6 +228,12 @@
|
|||
<ClInclude Include="..\..\..\base\include\ods.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FilePanelDlg.h">
|
||||
<Filter>dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HostList.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Trochilus.cpp">
|
||||
|
@ -254,15 +248,6 @@
|
|||
<ClCompile Include="common.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PanelDlg.cpp">
|
||||
<Filter>dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MasterModuleManager.cpp">
|
||||
<Filter>control</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ClientControlPanelManager.cpp">
|
||||
<Filter>control</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\base\include\json\json_reader.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
|
@ -308,9 +293,6 @@
|
|||
<ClCompile Include="IconLoader.cpp">
|
||||
<Filter>control</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InstallDlg.cpp">
|
||||
<Filter>dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\base\include\mfcresize\Resizer.cpp">
|
||||
<Filter>resize</Filter>
|
||||
</ClCompile>
|
||||
|
@ -320,6 +302,12 @@
|
|||
<ClCompile Include="..\..\..\base\include\ods.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FilePanelDlg.cpp">
|
||||
<Filter>dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HostList.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Trochilus.rc">
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "Trochilus.h"
|
||||
#include "TrochilusDlg.h"
|
||||
#include "PanelDlg.h"
|
||||
#include "FilePanelDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "MasterModuleManager.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -43,6 +42,7 @@ void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
|||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
||||
ON_WM_SYSCOMMAND()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
@ -68,6 +68,7 @@ BEGIN_MESSAGE_MAP(CTrochilusDlg, CDialogEx)
|
|||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_MAIN, &CTrochilusDlg::OnTcnSelchangeTabMain)
|
||||
|
||||
ON_WM_SIZE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -106,6 +107,9 @@ BOOL CTrochilusDlg::InitView()
|
|||
m_LisDlg.Create(IDD_DIALOG_LIS,&m_tabMain);
|
||||
m_LisDlg.MoveWindow(&rs);
|
||||
|
||||
m_HostDlg.SetParent(CWnd::FromHandle(m_tabMain.m_hWnd));
|
||||
m_LisDlg.SetParent(CWnd::FromHandle(m_tabMain.m_hWnd));
|
||||
|
||||
m_HostDlg.ShowWindow(TRUE);
|
||||
//³õʼ»¯×´Ì¬À¸
|
||||
CRect rect;
|
||||
|
@ -147,20 +151,6 @@ BOOL CTrochilusDlg::OnInitDialog()
|
|||
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||
|
||||
// CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||
// if (pSysMenu != NULL)
|
||||
// {
|
||||
// BOOL bNameValid;
|
||||
// CString strAboutMenu;
|
||||
// bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||||
// ASSERT(bNameValid);
|
||||
// if (!strAboutMenu.IsEmpty())
|
||||
// {
|
||||
// pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||
// pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||
// }
|
||||
// }
|
||||
|
||||
SetIcon(m_hIcon, TRUE);
|
||||
SetIcon(m_hIcon, FALSE);
|
||||
|
||||
|
@ -169,7 +159,7 @@ BOOL CTrochilusDlg::OnInitDialog()
|
|||
ExitProcess(0);
|
||||
}
|
||||
|
||||
InitResize();
|
||||
//InitResize();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -251,4 +241,3 @@ void CTrochilusDlg::OnSize(UINT nType, int cx, int cy)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
#include "thread/RepeatTask.h"
|
||||
#include "HostDlg.h"
|
||||
#include "ListenDlg.h"
|
||||
#include "mfcresize/Resizer.h"
|
||||
|
@ -46,4 +47,5 @@ public:
|
|||
|
||||
afx_msg void OnTcnSelchangeTabMain(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
|
||||
};
|
||||
|
|
|
@ -118,8 +118,6 @@ void common::SetWindowFont( HWND hWnd )
|
|||
|
||||
CWnd* pw = CWnd::FromHandle(hWnd);
|
||||
|
||||
pw->GetDlgItem(IDC_LIST_CLIENT)->SetFont(pFont);
|
||||
|
||||
do
|
||||
{
|
||||
pw->SetFont(pFont);
|
||||
|
|
Binary file not shown.
|
@ -67,7 +67,6 @@
|
|||
#include "common.h"
|
||||
#include "../../master/master/masterInclude.h"
|
||||
|
||||
#include "MasterModuleManager.h"
|
||||
#include "IModule.h"
|
||||
|
||||
#define OUTPUT_LOG
|
||||
|
|
|
@ -28,7 +28,7 @@ BOOL ClientInfoManager::Init()
|
|||
BOOL ClientInfoManager::MsgHandler_OutputError( MSGID msgid, const CommData& commData, LPVOID lpParameter )
|
||||
{
|
||||
DECLARE_STR_PARAM(error);
|
||||
ClientInfoManager::GetInstanceRef().QueryModuleInfo(commData.GetClientID(),MODULE_MSG_NOTIFYMSG,(LPVOID)error.c_str(),(LPVOID)MODULE_TYPE_ERROR);
|
||||
errorLog(_T("[CLIENT ERROR][%s] %s"),error.c_str(),commData.GetClientID());
|
||||
return TRUE;
|
||||
}
|
||||
BOOL ClientInfoManager::MsgHandler_ClientInfo( MSGID msgid, const CommData& commData, LPVOID lpParameter )
|
||||
|
@ -381,48 +381,4 @@ void ClientInfoManager::TransferInfo( LPCTSTR clientid, const CLIENT_BASE_INFO*
|
|||
info.windowsVersion = WINDOWS_VERSION_NONE;
|
||||
info.localIPCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ClientInfoManager::QueryModuleStatus( LPCTSTR clientid, LPCTSTR moduleName, MODULE_INST_STATUS& status, MSGSERIALID* pMsgserial )
|
||||
{
|
||||
status = MODULESTATUS_UNINSTALLED;
|
||||
|
||||
m_infoMapSection.Enter();
|
||||
{
|
||||
ClientBaseInfoMap::const_iterator iter = m_clientBaseInfoMap.find(clientid);
|
||||
if (iter != m_clientBaseInfoMap.end())
|
||||
{
|
||||
const CLIENT_BASE_INFO& info = iter->second;
|
||||
|
||||
//²éѯģ¿éÊÇ·ñÒÑ°²×°
|
||||
CString modname(moduleName);
|
||||
modname.MakeLower();
|
||||
CString findstr(modname);
|
||||
findstr += ',';
|
||||
if (info.mods.find((LPCTSTR)findstr) != tstring::npos)
|
||||
{
|
||||
status = MODULESTATUS_INSTALLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgSerialIDMap::const_iterator msiter = info.installModMsgIDMap.find((LPCTSTR)modname);
|
||||
if (msiter != info.installModMsgIDMap.end())
|
||||
{
|
||||
status = MODULESTATUS_INSTALLING;
|
||||
if (NULL != pMsgserial) *pMsgserial = msiter->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_infoMapSection.Leave();
|
||||
}
|
||||
void ClientInfoManager::SetModuleCallBack(FnModuleNotifyProc func)
|
||||
{
|
||||
m_fnModuleCallback = func;
|
||||
}
|
||||
|
||||
void ClientInfoManager::QueryModuleInfo(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter)
|
||||
{
|
||||
if(m_fnModuleCallback)
|
||||
m_fnModuleCallback(clientid,nMsg,lpContext,lpParameter);
|
||||
}
|
|
@ -46,10 +46,7 @@ public:
|
|||
void SetCallbacks(FnNotifyProc fnCallback, LPVOID lpParameter);
|
||||
BOOL InstallModule(LPCTSTR clientid, LPCTSTR moduleName);
|
||||
void TransferInfo(LPCTSTR clientid, const CLIENT_BASE_INFO* pBaseInfo, CLIENT_INFO& info) const;
|
||||
void QueryModuleStatus(LPCTSTR clientid, LPCTSTR moduleName, MODULE_INST_STATUS& status, MSGSERIALID* pMsgserial);
|
||||
|
||||
void SetModuleCallBack(FnModuleNotifyProc func);
|
||||
void QueryModuleInfo(LPCTSTR clientid,UINT nMsg, LPVOID lpContext, LPVOID lpParameter);
|
||||
void HandleInstalMsg(tstring clientid,CLIENT_BASE_INFO& info);
|
||||
|
||||
static BOOL MsgHandler_OutputError( MSGID msgid, const CommData& commData, LPVOID lpParameter );
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct
|
|||
tstring clientid;
|
||||
tstring findstr;
|
||||
IRCFileOperation* pFo;
|
||||
FnModuleNotifyProc fnProc;
|
||||
tstring notify;
|
||||
LPVOID lpParameter1;
|
||||
BOOL bForce;
|
||||
|
|
|
@ -133,7 +133,7 @@ static DWORD WINAPI ListFileThread(LPVOID lpParameter)
|
|||
|
||||
int nMsg = pParam->pFo == &g_rfo ? MODULE_MSG_LISTREMOTEFILE : MODULE_MSG_LISTLOCALFILE;
|
||||
|
||||
ClientInfoManager::GetInstanceRef().QueryModuleInfo(pParam->clientid.c_str(),nMsg,(LPVOID)retjson.c_str(),pParam->lpParameter1);
|
||||
pParam->fnProc(pParam->clientid.c_str(),nMsg,(LPVOID)retjson.c_str(),pParam->lpParameter1);
|
||||
}
|
||||
|
||||
delete pParam;
|
||||
|
@ -198,7 +198,7 @@ static DWORD WINAPI ListDiskThread(LPVOID lpParameter)
|
|||
|
||||
int nMsg = pParam->pFO == &g_rfo ? MODULE_MSG_LISTREMOTEFILE : MODULE_MSG_LISTLOCALFILE;
|
||||
|
||||
ClientInfoManager::GetInstanceRef().QueryModuleInfo(pParam->clientid.c_str(),nMsg,(LPVOID)retjson.c_str(),pParam->lpParameter1);
|
||||
pParam->fnProc(pParam->clientid.c_str(),nMsg,(LPVOID)retjson.c_str(),pParam->lpParameter1);
|
||||
}
|
||||
|
||||
delete pParam;
|
||||
|
@ -301,7 +301,7 @@ MASTER2_API void CloseShell(LPCTSTR clientid)
|
|||
ShellManager::GetInstanceRef().CloseShell(clientid);
|
||||
}
|
||||
|
||||
MASTER2_API void AsynListFiles( LPCTSTR clientid, LPCTSTR findstr,BOOL isClient, LPVOID lpParameter )
|
||||
MASTER2_API void AsynListFiles( LPCTSTR clientid, LPCTSTR findstr,BOOL isClient, FnModuleNotifyProc callback ,LPVOID lpParameter )
|
||||
{
|
||||
LIST_FILE_PARAMETER* pData = new LIST_FILE_PARAMETER;
|
||||
|
||||
|
@ -309,19 +309,20 @@ MASTER2_API void AsynListFiles( LPCTSTR clientid, LPCTSTR findstr,BOOL isClient,
|
|||
pData->clientid = clientid;
|
||||
pData->findstr = findstr;
|
||||
pData->lpParameter1 = lpParameter;
|
||||
pData->fnProc = callback;
|
||||
|
||||
DWORD dwThreadId;
|
||||
CreateThread(NULL,0,ListFileThread, pData,0, &dwThreadId);
|
||||
}
|
||||
MASTER2_API void AsynListDisks( LPCWSTR clientid,BOOL isClient, LPVOID lpParameter )
|
||||
MASTER2_API void AsynListDisks( LPCWSTR clientid,BOOL isClient, FnModuleNotifyProc callback , LPVOID lpParameter )
|
||||
{
|
||||
LIST_DISK_PARAMETER* pData = new LIST_DISK_PARAMETER;
|
||||
pData->lpParameter1 = lpParameter;
|
||||
pData->fnProc = callback;
|
||||
|
||||
pData->pFO = isClient ? (IRCFileOperation*)&g_rfo : (IRCFileOperation*)&g_lfo;
|
||||
|
||||
pData->clientid = clientid;
|
||||
pData->lpParameter1 = lpParameter;
|
||||
|
||||
DWORD dwThreadId;
|
||||
CreateThread(NULL,0,ListDiskThread, pData,0, &dwThreadId);
|
||||
|
@ -487,27 +488,6 @@ MASTER2_API BOOL QuerySendingMessageStatus( LPCTSTR clientid, MSGSERIALID sendMs
|
|||
return CommManager::GetInstanceRef().QuerySendStatus(clientid, sendMsgserialid, *pdwSentBytes, *pdwTotalBytes);
|
||||
}
|
||||
|
||||
|
||||
MASTER2_API void QueryModuleInstallStatus( LPCTSTR clientid, LPCTSTR moduleName, MODULE_INST_STATUS* pStatus, UINT* pProgress )
|
||||
{
|
||||
if (NULL == pStatus || NULL == pProgress) return;
|
||||
|
||||
MSGSERIALID serial;
|
||||
ClientInfoManager::GetInstanceRef().QueryModuleStatus(clientid, moduleName, *pStatus, &serial);
|
||||
|
||||
if (*pStatus == MODULESTATUS_INSTALLING)
|
||||
{
|
||||
*pProgress = 0;
|
||||
|
||||
DWORD dwSentBytes = 0;
|
||||
DWORD dwTotalBytes = 0;
|
||||
if (CommManager::GetInstanceRef().QuerySendStatus(clientid, serial, dwSentBytes, dwTotalBytes))
|
||||
{
|
||||
*pProgress = dwSentBytes * 100 / dwTotalBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MASTER2_API BOOL ModifyPacketStatus(ULONG serial,LPCTSTR clientid,BOOL status)
|
||||
{
|
||||
return CommManager::GetInstanceRef().ModifyPacketStatus(serial,clientid,status);
|
||||
|
@ -601,11 +581,6 @@ MASTER2_API void RunRemoteFile(LPCTSTR clientid,LPCTSTR clientpath)
|
|||
}
|
||||
|
||||
/***********************Ä£¿é¹¦ÄÜAPI***********************************/
|
||||
MASTER2_API void SetModuleCallBack(FnModuleNotifyProc func)
|
||||
{
|
||||
ClientInfoManager::GetInstanceRef().SetModuleCallBack(func);
|
||||
}
|
||||
|
||||
MASTER2_API void HttpDownLoad(LPCTSTR clientid,LPCTSTR url,LPCTSTR path)
|
||||
{
|
||||
return CHttpDown::GetInstanceRef().Down(clientid,url,path);
|
||||
|
|
|
@ -18,7 +18,6 @@ EXPORTS
|
|||
RegisterCommMsgHandler @13
|
||||
QuerySendingMessageStatus @14
|
||||
|
||||
QueryModuleInstallStatus @17
|
||||
StopMasterWorking @18
|
||||
|
||||
AsynListFiles @21
|
||||
|
|
|
@ -51,9 +51,9 @@ MASTER2_API void DeleteRemoteFile(LPCTSTR clientid,LPCTSTR clientpath);
|
|||
MASTER2_API void RunRemoteFile(LPCTSTR clientid,LPCTSTR clientpath);
|
||||
|
||||
//文件浏览相关接口
|
||||
MASTER2_API void AsynListFiles( LPCTSTR clientid, LPCTSTR findstr,BOOL isClient, LPVOID lpParameter);
|
||||
MASTER2_API void AsynListFiles( LPCTSTR clientid, LPCTSTR findstr,BOOL isClient, FnModuleNotifyProc callback ,LPVOID lpParameter);
|
||||
|
||||
MASTER2_API void AsynListDisks( LPCWSTR clientid,BOOL isClient, LPVOID lpParameter );
|
||||
MASTER2_API void AsynListDisks( LPCWSTR clientid,BOOL isClient, FnModuleNotifyProc callback , LPVOID lpParameter );
|
||||
|
||||
//启动Master
|
||||
MASTER2_API BOOL StartMasterWorking();
|
||||
|
@ -100,17 +100,11 @@ MASTER2_API BOOL MakeClientSelfDestruction(LPCTSTR clientid);
|
|||
//获取客户端的基础信息
|
||||
MASTER2_API BOOL GetClientInfo(LPCTSTR clientid, CLIENT_INFO* clientBaseInfo);
|
||||
|
||||
//查询模块在客户端的状态和安装进度
|
||||
MASTER2_API void QueryModuleInstallStatus(LPCTSTR clientid, LPCTSTR moduleName, MODULE_INST_STATUS* pStatus, UINT* pProgress);
|
||||
|
||||
//关闭MASTER
|
||||
MASTER2_API void StopMasterWorking();
|
||||
|
||||
//修改Packet状态
|
||||
MASTER2_API BOOL ModifyPacketStatus(ULONG serial,LPCTSTR clientid,BOOL status);
|
||||
|
||||
//设置模块回调
|
||||
MASTER2_API void SetModuleCallBack(FnModuleNotifyProc func);
|
||||
|
||||
//使用HTTP下载文件
|
||||
MASTER2_API void HttpDownLoad(LPCTSTR clientid,LPCTSTR url,LPCTSTR path);
|
|
@ -6,20 +6,13 @@ public:
|
|||
CString m_clientid;
|
||||
CString m_modname;
|
||||
CLIENT_INFO m_clientinfo;
|
||||
FnModuleNotifyProc m_handleMsg;
|
||||
|
||||
static BOOL InitModule(LPCTSTR clientid,CLIENT_INFO& info,FnModuleNotifyProc fnCallback,LPVOID lpParameter)
|
||||
BOOL InitModule(LPCTSTR clientid)
|
||||
{
|
||||
IModule* lpModule = dynamic_cast<IModule*>((CDialogEx*)lpParameter);
|
||||
lpModule->m_clientid = clientid;
|
||||
lpModule->m_clientinfo = info;
|
||||
lpModule->m_handleMsg = fnCallback;
|
||||
m_clientid = clientid;
|
||||
|
||||
GetClientInfo(clientid,&m_clientinfo);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CommitNotifyMsg(int nType,LPCTSTR content)
|
||||
{
|
||||
m_handleMsg(m_clientid,MODULE_MSG_NOTIFYMSG,(LPVOID)content,(LPVOID)nType);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue