資源簡介
當你寫完驅動程序并測試成功后 ,那還沒有完成,還必須進行打包,一個良好的打包界面很吸引人的
代碼片段和文件信息
//?DeviceListCtrl.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“EzDriverSetup.h“
#include?“DeviceListCtrl.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CDeviceListCtrl
#ifndef?DT
#define?DT DebugTrace
extern?BOOL?DebugTrace(const?char?*?lpszFormat...);
#endif
#pragma?comment(lib“cfgmgr32.lib“)
#pragma?comment(lib“cfgmgr.lib“)
#pragma?comment(lib“ccfapi32.lib“)
CDeviceListCtrl::CDeviceListCtrl()
{
ZeroMemory(&m_sidsizeof(m_sid));
m_hDevInfo?=?NULL;
}
CDeviceListCtrl::~CDeviceListCtrl()
{
}
BEGIN_MESSAGE_MAP(CDeviceListCtrl?CListCtrl)
//{{AFX_MSG_MAP(CDeviceListCtrl)
ON_WM_DESTROY()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CDeviceListCtrl?message?handlers
void?CDeviceListCtrl::OnDestroy()?
{
int?nc?=?this->GetItemCount();
for(int?i=0;i {
CItemData?*pData?=?(CItemData?*)GetItemData(i);
if(pData)
{
SetItemData(iNULL);
delete?pData;
}
}
SetupDiDestroyClassImageList(&m_sid);
CListCtrl::OnDestroy();
}
void?CDeviceListCtrl::PreSubclassWindow()?
{
Init();
CListCtrl::PreSubclassWindow();
}
int?CDeviceListCtrl::OnCreate(LPCREATESTRUCT?lpCreateStruct)?
{
if?(CListCtrl::OnCreate(lpCreateStruct)?==?-1)
return?-1;
Init();
return?0;
}
void?CDeviceListCtrl::Init()
{
ASSERT(!m_sid.ImageList);
Reset();
}
void?CDeviceListCtrl::Reset()
{
if(!GetSafeHwnd())
return;
DeleteAllItems();
SetupDiDestroyClassImageList(&m_sid);
m_sid.cbSize?=?sizeof(m_sid);
m_sid.ImageList?=?NULL;
m_sid.Reserved?=?0;
SetupDiGetClassImageList(&m_sid);
CImageList?*pImageList?=?CImageList::FromHandle(m_sid.ImageList);
SetImageList(pImageListLVSIL_NORMAL);
int?nc?=?GetImageList(LVSIL_NORMAL)->GetImageCount();
GetImageList(LVSIL_NORMAL)->SetOverlayImage(nc-21);
GetImageList(LVSIL_NORMAL)->SetOverlayImage(nc-32);
if(m_hDevInfo)
{
SetupDiDestroyDeviceInfoList(m_hDevInfo);
m_hDevInfo?=?NULL;
}
m_szCurHwID.Empty();
m_szInfFile.Empty();
}
BOOL?CDeviceListCtrl::DeleteAllItems()
{
//delete?item‘s?data
int?nc?=?GetItemCount();
for(int?i=0;i {
CItemData?*pItemData?=?(CItemData?*)GetItemData(i);
delete?pItemData;
SetItemData(iNULL);
}
return?CListCtrl::DeleteAllItems();
}
BOOL?CDeviceListCtrl::OpenInfFile(CString?szInfFile)
{
//cleanup?old?items
Reset();
CStringArray?szArrHwID;
{
CInfFileHelper?infHelper;
if(!infHelper.OpenInfFile(szInfFile))
return?FALSE;
CStringArray?szArr;
infHelper.GetManufacturer(szArr);
for(int?i=0;i {
CStringArray?szArrHwIDTemp;
infHelper.GetHardwareID(szArr[i]szArrHwIDTemp);
szArrHwID.Append(szArrHwIDTemp);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2005-05-11?14:21??EzDriverSetup
?????文件??????11051??2005-05-11?14:18??EzDriverSetup\DeviceListCtrl.cpp
?????文件???????2584??2005-05-11?14:10??EzDriverSetup\DeviceListCtrl.h
?????文件???????8572??2005-03-26?23:11??EzDriverSetup\DriverSetupHelper.cpp
?????文件???????1085??2005-03-26?23:07??EzDriverSetup\DriverSetupHelper.h
?????文件???????2220??2005-03-28?15:18??EzDriverSetup\EzDriverSetup.cpp
?????文件???????4710??2005-03-29?09:41??EzDriverSetup\EzDriverSetup.dsp
?????文件????????549??2005-03-23?09:59??EzDriverSetup\EzDriverSetup.dsw
?????文件???????1401??2005-03-23?09:59??EzDriverSetup\EzDriverSetup.h
?????文件???????7164??2005-05-11?14:10??EzDriverSetup\EzDriverSetup.rc
?????文件??????14229??2005-05-11?14:20??EzDriverSetup\EzDriverSetupDlg.cpp
?????文件???????2205??2005-03-29?09:29??EzDriverSetup\EzDriverSetupDlg.h
?????文件???????3719??2005-03-26?22:56??EzDriverSetup\InfFileHelper.cpp
?????文件????????869??2005-03-24?15:35??EzDriverSetup\InfFileHelper.h
?????文件???????3705??2005-03-23?09:59??EzDriverSetup\ReadMe.txt
?????目錄??????????0??2005-05-11?14:21??EzDriverSetup\Release
?????文件??????36864??2005-05-11?14:20??EzDriverSetup\Release\EzDriverSetup.exe
?????目錄??????????0??2005-03-28?09:00??EzDriverSetup\res
?????文件???????1078??2005-03-23?09:59??EzDriverSetup\res\EzDriverSetup.ico
?????文件????????405??2005-03-23?09:59??EzDriverSetup\res\EzDriverSetup.rc2
?????文件???????1512??2005-05-11?14:10??EzDriverSetup\resource.h
?????文件????????215??2005-03-23?09:59??EzDriverSetup\StdAfx.cpp
?????文件???????1054??2005-03-23?09:59??EzDriverSetup\StdAfx.h
-----------?---------??----------?-----??----
???????????????105191????????????????????23
評論
共有 條評論