⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 straceguidoc.cpp

📁 Strace: Webcrazy原来写的很好的代码
💻 CPP
字号:
// StraceGuiDoc.cpp : implementation of the CStraceGuiDoc class
//

#include "stdafx.h"

#include "StraceGui.h"
#include "StraceGuiDoc.h"
#include "ListCtrlEx.h"
#include "ListVwEx.h"
#include "ProcFilterDlg.h"
#include "StraceGuiView.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStraceGuiDoc

IMPLEMENT_DYNCREATE(CStraceGuiDoc, CDocument)

BEGIN_MESSAGE_MAP(CStraceGuiDoc, CDocument)
	//{{AFX_MSG_MAP(CStraceGuiDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStraceGuiDoc construction/destruction

CStraceGuiDoc::CStraceGuiDoc()
{
	// TODO: add one-time construction code here

}

CStraceGuiDoc::~CStraceGuiDoc()
{
}

BOOL CStraceGuiDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)


	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CStraceGuiDoc serialization

void CStraceGuiDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		POSITION pos = GetFirstViewPosition();
		if(!pos) return ;
		CStraceGuiView* pView = (CStraceGuiView*)GetNextView(pos);
		CListCtrl& ListCtrl = pView->GetListCtrl();
		char buf[255];
		LV_ITEM lvi;
		lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
		lvi.iSubItem = 0;
		lvi.pszText = buf;
		lvi.cchTextMax = sizeof(buf);
		lvi.stateMask = 0xFFFF;		// get all state flags
		LV_COLUMN lvc;
		lvc.mask = LVCF_FMT | LVCF_WIDTH;
		CString strLine;
		BYTE nl[] = { 0x0D,0x0A };
		BYTE tab[] = {0x9};
		
		for(int i=0;i < ListCtrl.GetItemCount();i++)
		{
			lvi.iItem = i;
			ListCtrl.GetItem(&lvi);
						   
			strLine.Empty();
			for(int nColumn = 0; ListCtrl.GetColumn(nColumn, &lvc); nColumn++)
			{
				int nRetLen = ListCtrl.GetItemText(i, nColumn,
								buf, sizeof(buf));
				if (nRetLen == 0)
					continue;
				ar.WriteString(CString(buf));
				ar.Write(tab,sizeof(tab));
			}
			ar.Write(nl,sizeof(nl));
		}

	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CStraceGuiDoc diagnostics

#ifdef _DEBUG
void CStraceGuiDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CStraceGuiDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CStraceGuiDoc commands

void CStraceGuiDoc::SetTitle(LPCTSTR lpszTitle) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CDocument::SetTitle("strace.log");
}

BOOL CStraceGuiDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CDocument::OnSaveDocument(lpszPathName);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -