cpptestdoc.cpp

来自「具有数据压缩和解压缩功能的地动态库。 采用Delphi内置的压缩库实现。压缩效」· C++ 代码 · 共 132 行

CPP
132
字号
// CPPTestDoc.cpp : implementation of the CCPPTestDoc class
//

#include "stdafx.h"
#include "CPPTest.h"

#include "CPPTestDoc.h"
#include "Compress.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCPPTestDoc

IMPLEMENT_DYNCREATE(CCPPTestDoc, CDocument)

BEGIN_MESSAGE_MAP(CCPPTestDoc, CDocument)
	//{{AFX_MSG_MAP(CCPPTestDoc)
	ON_COMMAND(ID_EDIT_CUT, OnEditCut)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCPPTestDoc construction/destruction

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

}

CCPPTestDoc::~CCPPTestDoc()
{
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CCPPTestDoc serialization

void CCPPTestDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CCPPTestDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CCPPTestDoc commands

UINT F(void *)
{
	char Buf[100] = "3111111aaaaaaaaaaaaaaaaaaaaa1112";
	char OBuf[100];
	int Len, Len2;
	char IBuf[100];

	while (1)
	{
		CompressBuffer(Buf, strlen(Buf), OBuf, &Len);
		DecompressBuffer(OBuf, Len, IBuf, &Len2);
		Sleep(5);
	}
}


UINT FF(void *)
{
	char Buf[100] = "3111111aaaaaaaaaaaaaaaaaaaaa1112";
	char OBuf[100];
	int Len, Len2;
	char IBuf[100];

	while (1)
	{
		CompressBuffer(Buf, strlen(Buf), OBuf, &Len);
		DecompressBuffer(OBuf, Len, IBuf, &Len2);
		Sleep(5);
	}
}

void CCPPTestDoc::OnEditCut() 
{
	char Buf[100] = "3111111aaaaaaaaaaaaaaaaaaaaa1112";
	char OBuf[100];
	int Len, Len2;
	char IBuf[100];

	//CompressBuffer(Buf, strlen(Buf), OBuf, &Len);
	//DecompressBuffer(OBuf, Len, IBuf, &Len2);
	//IBuf[Len2] = 0;
	//AfxMessageBox(IBuf);
	//AfxBeginThread(F, NULL);
	AfxBeginThread(F, NULL);
	AfxBeginThread(FF, NULL);
}

⌨️ 快捷键说明

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