Files
Sun1602/Tools/CrashInfomationReport/CrashReport/CrashReportDlg.cpp
T
2022-10-26 12:25:11 +08:00

704 lines
20 KiB
C++

// CrashReportDlg.cpp : 구현 파일
//
#include "stdafx.h"
#include "CrashReport.h"
#include "CrashReportDlg.h"
#include "XLEzAutomation.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
TCHAR LISTCTRLSTRING[eSTRINGTABLE_TABLEMAX][255] =
{
{L"No."},
{L"소스위치"},
{L"라인위치"},
{L"충돌주소"},
{L"충돌함수"},
{L"충돌된 갯수"},
{L"백분위"},
{L"크레쉬 원인"},
};
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 대화 상자 데이터입니다.
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다.
// 구현입니다.
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnUpdateLoadmap(CCmdUI *pCmdUI);
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
ON_UPDATE_COMMAND_UI(ID_LOADMAP, &CAboutDlg::OnUpdateLoadmap)
END_MESSAGE_MAP()
// CCrashReportDlg 대화 상자
static int CALLBACK BrowseProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
{
if( BFFM_INITIALIZED == uMsg )
SendMessage( hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, (LPARAM)lpData );
return 0;
}
CCrashReportDlg::CCrashReportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCrashReportDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CCrashReportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_REPORTLIST, cListCtrl_CrashInfo_);
DDX_Control(pDX, IDC_LISTDMPEXCEP, ListExceptionDmpFile_);
DDX_Control(pDX, IDC_LISTRESULTDMP, ResultDumpListView_);
DDX_Control(pDX, IDC_LISTCALLSTACK, CallStackList_);
}
BEGIN_MESSAGE_MAP(CCrashReportDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_COMMAND(ID_LOADDIR, &CCrashReportDlg::OnLoaddir)
ON_COMMAND(ID_LOADPDB, &CCrashReportDlg::OnLoadpdb)
ON_UPDATE_COMMAND_UI(ID_LOADMAP, &CCrashReportDlg::OnUpdateLoadmap)
ON_BN_CLICKED(IDC_BUTTON1, &CCrashReportDlg::OnBnClickedButton1)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_REPORTLIST, &CCrashReportDlg::OnLvnColumnclickReportlist)
ON_NOTIFY(NM_RCLICK, IDC_REPORTLIST, &CCrashReportDlg::OnNMRClickReportlist)
ON_NOTIFY(NM_CLICK, IDC_REPORTLIST, &CCrashReportDlg::OnNMClickReportlist)
ON_LBN_SELCHANGE(IDC_LISTRESULTDMP, &CCrashReportDlg::OnLbnSelchangeListresultdmp)
ON_COMMAND(ID_EXPORTEX, &CCrashReportDlg::OnExportex)
ON_COMMAND(ID_SENDMAIL, &CCrashReportDlg::OnSendmail)
END_MESSAGE_MAP()
// CCrashReportDlg 메시지 처리기
BOOL CCrashReportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
// 프레임워크가 이 작업을 자동으로 수행합니다.
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
// TODO: 여기에 추가 초기화 작업을 추가합니다.
InitListCtrl();
CallStackList_.ResetContent();
ExceptionListStruct_List_.clear();
DumpFileList_.clear();
NotFindDumpMemoryList_.clear();
DialogMailSender_.Create(CDlgMailSender::IDD,this);
DialogMailSender_.ShowWindow(SW_HIDE);
return TRUE; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다.
}
void CCrashReportDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
// 프레임워크에서 이 작업을 자동으로 수행합니다.
void CCrashReportDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 아이콘을 그립니다.
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
// 이 함수를 호출합니다.
HCURSOR CCrashReportDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
BOOL CCrashReportDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
if(pMsg->message == WM_KEYDOWN)
{
switch(pMsg->wParam)
{
case VK_RETURN:
case VK_ESCAPE:
{
pMsg->wParam = NULL;
}
default:
break;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
bool CCrashReportDlg::GetFolderPath( CString& Path )
{
TCHAR szPathName[MAX_PATH];
BROWSEINFO cBrowseInfo;
cBrowseInfo.hwndOwner = GetSafeHwnd();
cBrowseInfo.pidlRoot = NULL;
cBrowseInfo.pszDisplayName = szPathName;
cBrowseInfo.lpszTitle = _T("디렉토리를 선택하시오");
cBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS;
cBrowseInfo.lpfn = BrowseProc;
cBrowseInfo.lParam = (LPARAM)_T("J:\\");
ITEMIDLIST* pidlBrowse = ::SHBrowseForFolder( &cBrowseInfo );
if( pidlBrowse )
{
::SHGetPathFromIDList( pidlBrowse, szPathName );
Path = szPathName;
return TRUE;
}
return FALSE;
}
void CCrashReportDlg::OnLoaddir()
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
//이미 두개가 실행된 상태! 다시 셋팅을 하자.
if (DumpFileList_.size() > 0 && GPROCESSMANAGER.GetProcess() != NULL)
ReleaseFileSetting();
CString CrashDir = _T("");
if(GetFolderPath(CrashDir))
{
CWnd* TextWindow = GetDlgItem(IDC_FOLDERPATH);
TextWindow->SetWindowText(CrashDir);
CFileFind fileFind;
CrashDir += L"\\*.*";
bool findfilebool = fileFind.FindFile(CrashDir);
while(findfilebool)
{
findfilebool = fileFind.FindNextFile();
if(fileFind.IsDots()) continue;
if (fileFind.IsDirectory()) continue;
else
{
CDumpProcess dumpElement;
if(dumpElement.LoadFile(fileFind.GetFilePath()))
DumpFileList_[fileFind.GetFilePath()] = dumpElement;
}
}
}
}
void CCrashReportDlg::OnLoadpdb()
{
//이미 두개가 실행된 상태! 다시 셋팅을 하자.
if (DumpFileList_.size() > 0 && GPROCESSMANAGER.GetProcess() != NULL)
ReleaseFileSetting();
// TODO: 여기에 명령 처리기 코드를 추가합니다.
CString FileFormatDefine = _T("Symbol File (*.EXE) | *.EXE; | All Files(*.*)|*.*||");
CFileDialog FileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_NOCHANGEDIR,FileFormatDefine);
if(FileDlg.DoModal())
{
CString FileName = FileDlg.GetPathName();
CWnd* TextWindow = GetDlgItem(IDC_PDBPATH);
TextWindow->SetWindowText(FileName);
GPROCESSMANAGER.CreateSymbolType(CBaseProcess::eSYMBOLTYPE_PDB);
GPROCESSMANAGER.LoadSymbolPath(FileName);
}
}
void CAboutDlg::OnUpdateLoadmap(CCmdUI *pCmdUI)
{
}
void CCrashReportDlg::InitListCtrl()
{
cListCtrl_CrashInfo_.DeleteAllItems();
cListCtrl_CrashInfo_.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_NUMBER,LISTCTRLSTRING[eSTRINGTABLE_NUMBER],0,80);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHLINE,
LISTCTRLSTRING[eSTRINGTABLE_CRASHLINE],0,400);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHMODULE,
LISTCTRLSTRING[eSTRINGTABLE_CRASHMODULE],0,80);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHADDR,
LISTCTRLSTRING[eSTRINGTABLE_CRASHADDR],0,80);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHFUNC,
LISTCTRLSTRING[eSTRINGTABLE_CRASHFUNC],0,180);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHCOUNT,
LISTCTRLSTRING[eSTRINGTABLE_CRASHCOUNT],0,80);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHPERCENT,
LISTCTRLSTRING[eSTRINGTABLE_CRASHPERCENT],0,80);
cListCtrl_CrashInfo_.InsertColumn(eSTRINGTABLE_CRASHSHOW,
LISTCTRLSTRING[eSTRINGTABLE_CRASHSHOW],0,170);
}
bool CCrashReportDlg::SetListCtrlPush( const ExceptionListStruct& info,int cell )
{
ExceptionListStruct CrashData = info;
CString ItemConvertString;
ItemConvertString.Format(L"%d",cell);
cListCtrl_CrashInfo_.InsertItem(cell,ItemConvertString);
cListCtrl_CrashInfo_.SetItemText(cell,0,ItemConvertString);
cListCtrl_CrashInfo_.SetItemText(cell,1,info.ExceptionInfo.ExceptionFileName);
ItemConvertString.Format(L"%d",(int)info.ExceptionInfo.FileSourceLine);
cListCtrl_CrashInfo_.SetItemText(cell,2,ItemConvertString);
ItemConvertString.Format(L"0x%x",(int)info.ExceptionAddr);
cListCtrl_CrashInfo_.SetItemText(cell,3,ItemConvertString);
cListCtrl_CrashInfo_.SetItemText(cell,4,info.ExceptionInfo.ExceptionFuntionName);
ItemConvertString.Format(L"%d",(int)info.ExceptionListCount);
cListCtrl_CrashInfo_.SetItemText(cell,5,ItemConvertString);
float percent = (float)info.ExceptionListCount / (float)DumpFileList_.size();
ItemConvertString.Format(L"%.2f %%",percent * 100.0f);
cListCtrl_CrashInfo_.SetItemText(cell,6,ItemConvertString);
cListCtrl_CrashInfo_.SetItemText(cell,7,CrashData.ExceptionshowString);
return true;
}
void CCrashReportDlg::OnUpdateLoadmap(CCmdUI *pCmdUI)
{
//이미 두개가 실행된 상태! 다시 셋팅을 하자.
if (DumpFileList_.size() > 0 && GPROCESSMANAGER.GetProcess() != NULL)
ReleaseFileSetting();
// TODO: 여기에 명령 업데이트 UI 처리기 코드를 추가합니다.
CString FileFormatDefine = _T("Symbol File (*.Map) | *.Map; | All Files(*.*)|*.*||");
CFileDialog FileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_NOCHANGEDIR,FileFormatDefine);
if(FileDlg.DoModal())
{
CString FileName = FileDlg.GetPathName();
CWnd* TextWindow = GetDlgItem(IDC_PDBPATH);
TextWindow->SetWindowText(FileName);
GPROCESSMANAGER.CreateSymbolType(CBaseProcess::eSYMBOLTYPE_MAP);
GPROCESSMANAGER.LoadSymbolPath(FileName);
}
}
void CCrashReportDlg::OnBnClickedButton1()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
if (DumpFileList_.empty())
{
MessageBox(L"현재 덤프 파일이 로드 되지 않았습니다.",L"오류",MB_OK);
return;
}
if(!GPROCESSMANAGER.GetProcess())
{
MessageBox(L"현재 심볼 파일이 로드 되지 않았습니다.",L"오류",MB_OK);
return;
}
int FindResultDump = 0;
std::map<CString,CDumpProcess>::iterator iterDumpList = DumpFileList_.begin();
for ( ; iterDumpList != DumpFileList_.end() ; ++iterDumpList)
{
DWORD AddressException = (DWORD)iterDumpList->second.GetExceptionAddr();
sExceptionInfomation ExceptionInfo;
ExceptionInfo.OnInit();
if(GPROCESSMANAGER.GetProcess()->OnSearch(AddressException,ExceptionInfo))
{
//정보를 가진 덤프가 존재 함으로
ExceptionListStruct AcceseExceptionFunction;
AcceseExceptionFunction.OnInit();
AcceseExceptionFunction.ExceptionAddr = AddressException;
AcceseExceptionFunction.ExceptionInfo = ExceptionInfo;
AcceseExceptionFunction.versionInfo = -1;
wsprintf(AcceseExceptionFunction.ExceptionshowString,L"%s",
iterDumpList->second.GetExceptionCodeStr());
//덤프에 대한 검사는 예외로 처리된 주소로 검사 한다.
std::vector<ExceptionListStruct>::iterator iter =
std::find(ExceptionListStruct_List_.begin(),ExceptionListStruct_List_.end()
,AddressException);
if(iter == ExceptionListStruct_List_.end())
{
AcceseExceptionFunction.FindDumpMemoryList_.push_back(iterDumpList->first);
ExceptionListStruct_List_.push_back(AcceseExceptionFunction);
}
else
{
(*iter).ExceptionListCount += 1;
(*iter).FindDumpMemoryList_.push_back(iterDumpList->first);
}
FindResultDump++;
}
else
{
//이부분에서는 메모리 주소가 존재 하지 않는 dmp파일 리스트가 들어간다.
NotFindDumpMemoryList_.push_back(iterDumpList->first);
ListExceptionDmpFile_.AddString(iterDumpList->first);
}
}
int ListCount = 0;;
for(size_t count = 0 ; count < ExceptionListStruct_List_.size() ; ++count)
{
SetListCtrlPush(ExceptionListStruct_List_[count],count);
}
CString IntgerToString;
IntgerToString.Format(L"%d",NotFindDumpMemoryList_.size());
CWnd* TextWindow = GetDlgItem(IDC_NODMPLIST);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",FindResultDump);
TextWindow = GetDlgItem(IDC_OKDMPLIST);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",DumpFileList_.size());
TextWindow = GetDlgItem(IDC_ALLFILE);
TextWindow->SetWindowText(IntgerToString);
}
void CCrashReportDlg::OnLvnColumnclickReportlist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
*pResult = 0;
}
void CCrashReportDlg::OnNMRClickReportlist(NMHDR *pNMHDR, LRESULT *pResult)
{
//LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<NMITEMACTIVATE>(pNMHDR);
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
*pResult = 0;
// LPNMLISTVIEW ListView = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// CString test = cListCtrl_CrashInfo_.GetItemText(ListView->uChanged,0);
}
void CCrashReportDlg::OnNMClickReportlist(NMHDR *pNMHDR, LRESULT *pResult)
{
// LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<NMITEMACTIVATE>(pNMHDR);
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
*pResult = 0;
LPNMLISTVIEW ListView = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
CString test = cListCtrl_CrashInfo_.GetItemText(ListView->iItem,1);
//아이템이 -1로 넘어올 경우가 있다.
if(ListView->iItem < 0)
return;
ExceptionListStruct exceptionposition = ExceptionListStruct_List_[ListView->iItem];
//일딴 이전 컨트롤 값 삭제
ResultDumpListView_.ResetContent();
//우 클릭시에 덤프 파일을 생성 하도록 만듬
for(size_t findCount = 0; findCount < exceptionposition.FindDumpMemoryList_.size() ; ++findCount)
ResultDumpListView_.AddString(exceptionposition.FindDumpMemoryList_[findCount]);
}
//덤프들의 정보를 보여준다.
void CCrashReportDlg::OnLbnSelchangeListresultdmp()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
int getCulCell = ResultDumpListView_.GetCurSel();
if(getCulCell == -1)
return;
CString ListToString;
ResultDumpListView_.GetText(getCulCell,ListToString);
//
std::map<CString,CDumpProcess>::iterator iterMap = DumpFileList_.find(ListToString);
if(iterMap == DumpFileList_.end())
return;
CDumpProcess DumpProcessItem = iterMap->second;
CString IntgerToString;
IntgerToString.Format(L"%d",DumpProcessItem.GetProcessTime());
CWnd* TextWindow = GetDlgItem(IDC_PROCESSTIME);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",DumpProcessItem.GetUserTime());
TextWindow = GetDlgItem(IDC_USERTIME);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",DumpProcessItem.GetKerenlTime());
TextWindow = GetDlgItem(IDC_KERNERTIME);
TextWindow->SetWindowText(IntgerToString);
TextWindow = GetDlgItem(IDC_CRASHCODE);
TextWindow->SetWindowText(DumpProcessItem.GetExceptionCodeStr());
IntgerToString.Format(L"0x%x",DumpProcessItem.GetExceptionAddr());
TextWindow = GetDlgItem(IDC_CRASHINFO2);
TextWindow->SetWindowText(IntgerToString);
TextWindow = GetDlgItem(IDC_MODULEINFO);
TextWindow->SetWindowText(DumpProcessItem.GetModuleInfo());
IntgerToString.Format(L"%d",DumpProcessItem.GetMajorVersion());
TextWindow = GetDlgItem(IDC_VERINFO);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",DumpProcessItem.GetBuildNumber());
TextWindow = GetDlgItem(IDC_BUILDNUM);
TextWindow->SetWindowText(IntgerToString);
IntgerToString.Format(L"%d",DumpProcessItem.GetPlatformId());
TextWindow = GetDlgItem(IDC_PLATFORMID);
TextWindow->SetWindowText(IntgerToString);
}
//모두 초기화 하는 코드
void CCrashReportDlg::ReleaseFileSetting()
{
GPROCESSMANAGER.DestoryProcess();
cListCtrl_CrashInfo_.DeleteAllItems();
ListExceptionDmpFile_.ResetContent();
ResultDumpListView_.ResetContent();
CallStackList_.ResetContent();
ExceptionListStruct_List_.clear();
NotFindDumpMemoryList_.clear();
DumpFileList_.clear();
CWnd* TextWindow = GetDlgItem(IDC_PROCESSTIME);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_USERTIME);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_KERNERTIME);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_CRASHCODE);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_CRASHINFO2);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_MODULEINFO);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_VERINFO);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_BUILDNUM);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_PLATFORMID);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_NODMPLIST);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_OKDMPLIST);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_ALLFILE);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_PDBPATH);
TextWindow->SetWindowText(L"");
TextWindow = GetDlgItem(IDC_FOLDERPATH);
TextWindow->SetWindowText(L"");
}
//엑셀로 리포팅 저장
void CCrashReportDlg::OnExportex()
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
int listcontrolItemcount = cListCtrl_CrashInfo_.GetItemCount();
int columnMax = eSTRINGTABLE_TABLEMAX;
int rowNumMax = (int)ExceptionListStruct_List_.size();
int CellNum = 2;
CString StrFileName;
//처리 과정을 보여 주지 않는다.
CXLEzAutomation ExccelFile(false);
//시스템 타임을 받아온다.
SYSTEMTIME SystemTime;
GetSystemTime(&SystemTime);
CString FileNameFormat;
//일-시간-분-초로 이름이 겹치지 않도록 한다.
FileNameFormat.Format(L"CrashReport_%d_%d_%d_%d.xlsx",SystemTime.wDay,SystemTime.wHour,
SystemTime.wMinute,SystemTime.wSecond);
ExccelFile.OpenExcelFile(FileNameFormat);
for (int ExcelList = 0 ; ExcelList < eSTRINGTABLE_TABLEMAX ; ++ExcelList)
{
ExccelFile.SetCellValue(ExcelList,1,LISTCTRLSTRING[ExcelList]);
}
//엑셀에 리스트 컨트롤 값 저장
for (int RowCount = 0 ; RowCount < rowNumMax ; ++RowCount)
{
for (int ColumnCount = 0 ; ColumnCount < columnMax ; ++ColumnCount)
{
CString ListText = cListCtrl_CrashInfo_.GetItemText(RowCount,ColumnCount);
ExccelFile.SetCellValue(ColumnCount,CellNum,ListText);
}
CellNum++;
}
//중간에 빈 공백이 들어 간다.
CellNum++;
ExccelFile.SetCellValue(1,CellNum++,L"예외 덤프 파일 목록");
//예외 파일 입력
for (size_t ExceptionDmp = 0 ; ExceptionDmp < NotFindDumpMemoryList_.size() ; ++ExceptionDmp)
{
ExccelFile.SetCellValue(1,CellNum,NotFindDumpMemoryList_[ExceptionDmp]);
CellNum++;
}
ExccelFile.SaveFileAs(FileNameFormat);
ExccelFile.ReleaseExcel();
theApp.Excelfile = FileNameFormat;
}
void CCrashReportDlg::OnSendmail()
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
DialogMailSender_.ShowWindow(SW_SHOW);
}