?? reportdlg.cpp
字號:
// ReportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resourceeditor.h"
#include "ReportDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReportDlg dialog
CReportDlg::CReportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CReportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReportDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pBinFactory = NULL;
}
void CReportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReportDlg)
DDX_Control(pDX, IDC_LST_REPORT, m_lstReport);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReportDlg, CDialog)
//{{AFX_MSG_MAP(CReportDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReportDlg message handlers
BOOL CReportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//m_lstProduct
m_lstReport.SetBkColor(RGB(232, 232, 232));
m_lstReport.ModifyStyle(0, LVS_SHOWSELALWAYS);
DWORD dwExStyle = m_lstReport.GetExtendedStyle();
dwExStyle |= LVS_EX_FULLROWSELECT;
dwExStyle |= LVS_EX_GRIDLINES;
m_lstReport.SetExtendedStyle(dwExStyle);
CString strClmn;
VERIFY( strClmn.LoadString(IDS_REPORT_COLUMN) );
int nLen = strClmn.GetLength();
LPTSTR lpBuf = strClmn.GetBuffer(nLen);
LPTSTR lpFind = _tcschr(lpBuf, _T(','));
int nIndex = 0;
while(lpFind != NULL)
{
*lpFind = _T('\0');
m_lstReport.InsertColumn(nIndex++,lpBuf,LVCFMT_LEFT,80);
lpBuf = lpFind + 1;
lpFind = _tcschr(lpBuf, _T(','));
}
m_lstReport.InsertColumn(nIndex, lpBuf, LVCFMT_LEFT, 100 );
FillList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CReportDlg::FillList()
{
CString strPrjName;
CString strData;
uint32 nData,nSum=0;
uint32 nArrSum[6] = {0};
int nModuleCount = g_theApp.m_prjarray.GetSize();
FILE *pPrjFile = NULL;
CString strErr;
for (int i=0;i<nModuleCount;++i)
{
strPrjName=g_theApp.m_prjarray[i];
CString strPrj=strPrjName;
int nleft=strPrj.ReverseFind(_T('\\'));
strPrj=strPrj.Right((strPrj.GetLength()-nleft-1));
m_lstReport.InsertItem(i,strPrj);
MMI_RESOURCE_T mmi_res_t;
if (!g_theApp.m_strPrjFileName.IsEmpty() &&
g_theApp.m_strPrjFileName.CompareNoCase(strPrjName)==0 &&
m_pBinFactory != NULL)
{
pPrjFile = NULL;
m_pBinFactory->CalcImgInfo();
m_pBinFactory->CalcAnimInfo();
m_pBinFactory->CalcRingInfo();
m_pBinFactory->CalcTextInfoEx();
m_pBinFactory->CalcFontInfoEx();
memcpy(&mmi_res_t,&(g_theApp.m_MMIRes),sizeof(MMI_RESOURCE_T));
}
else
{
pPrjFile=_tfopen((LPCTSTR)strPrjName, _T("rb"));
if( pPrjFile == NULL )
{
strErr.Format(IDS_ERR_OPEN_PRJ_FAIL,strPrjName);
AfxMessageBox(strErr);
fclose(pPrjFile);
return FALSE;
}
PRJ_BIN_ADDR_DATA prj_info;
if (fread(&prj_info,sizeof(PRJ_BIN_ADDR_DATA),1,pPrjFile)!=1)
{
strErr.Format(IDS_ERR_READ_PRJ_FOR_SIZE,strPrjName);
AfxMessageBox(strErr);
fclose(pPrjFile);
return FALSE;
}
fseek(pPrjFile,prj_info.win_addr,SEEK_SET);
if (fread(&mmi_res_t,sizeof(MMI_RESOURCE_T),1,pPrjFile)!=1)
{
strErr.Format(IDS_ERR_READ_PRJ_FOR_SIZE,strPrjName);
AfxMessageBox(strErr);
fclose(pPrjFile);
return FALSE;
}
}
nSum = 0;
for(int j = 1;j<=5;j++)
{
nData = ((MMI_RES_DATA_T)(mmi_res_t.mmi_data_table[j-1])).uSize;
strData.Format(_T("%d"),nData);
m_lstReport.SetItemText(i,j,strData);
nSum += nData;
nArrSum[j-1]+=nData;
}
nArrSum[5]+=nSum;
strData.Format(_T("%d"),nSum);
m_lstReport.SetItemText(i,6,strData);
if(pPrjFile != NULL)
fclose(pPrjFile);
}
CString strCol;
strCol.LoadString(IDS_TOTALSUM);
m_lstReport.InsertItem(nModuleCount,strCol);
for(int k=1;k<=6;k++)
{
strData.Format(_T("%d"),nArrSum[k-1]);
m_lstReport.SetItemText(nModuleCount,k,strData);
}
return TRUE;
}
void CReportDlg::SetBinFileFactory(CBinFileFactory * pBinFactory)
{
ASSERT(pBinFactory != NULL);
m_pBinFactory = pBinFactory;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -