- 博客(0)
- 资源 (23)
- 收藏
- 关注
WinCE ZIP 压缩解压缩源代码
支持缓冲区 文件的zip格式压缩解压缩
内有main.c示例代码
内有bug.txt 总结两个新手容易遇到的问题(本人也是新手呵呵,在使用过程中发现的两个问题,总结了解决方案)
2011-09-06
TraceWin 定向日志工具
一般的日志工具。方便一些日志记录观察.
////////////////////////////////////////////////////////////////
// TraceWin Copyright 1995-1999 Paul DiLascia
// If this program works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
//
// NOTE: If you're using PixieLib, you don't need to include this file.
// It's already included by the library.
//
// ***************************************************************************
// TraceWin is a tool that displays MFC diagnostic (afxDump, TRACE) output
// in the window of the TraceWin applet.
//
// To use TraceWin, you must #include this file somewhere in your main program
// file (typically where you implement your CWinApp). Since this file contains
// code, you should #include it in only once--i.e. NOT in StdAfx.h--or you'll
// get multiply-defined symbol errors in the linker. This file contains an
// auto-initializing static variable that works in most cases; but you may miss
// some TRACE output from constructors of static objects. If so, you can
// manually call PxlTraceInit before your first TRACE call.
//
// To see the output, you also need the TraceWin applet, TraceWin.exe, which
// you can download http://pobox.com/~dilascia
//
// ***************************************************************************
//
#ifdef _DEBUG
// Window class name used by the main window of the TRACEWIN applet.
#define TRACEWND_CLASSNAME _T("TraceWin TRACE Window")
#define OLDTRACEWND_CLASSNAME _T("MfxTraceWindow") // backwards compat
// ID sent as COPYDATASRUCT::dwData to identify the WM_COPYDATA message
// as coming from an app using TraceWin.
#define ID_COPYDATA_TRACEMSG MAKELONG(MAKEWORD('t','w'),MAKEWORD('i','n'))
//////////////////
// CFileTrace is a CFile that "writes" to the trace window
//
class CFileTrace : public CFile {
DECLARE_DYNAMIC(CFileTrace)
CFileTrace() { m_strFileName = _T("Mfx File Tracer"); }
static BOOL autoInit;
virtual void Write(const void* lpBuf, UINT nCount);
public:
static BOOL Init();
};
IMPLEMENT_DYNAMIC(CFileTrace, CFile)
//////////////////
// Override to write to TraceWin applet instead of file.
//
void CFileTrace::Write(const void* lpBuf, UINT nCount)
{
if (!afxTraceEnabled)
return; // MFC tracing not enabled
HWND hTraceWnd = ::FindWindow(TRACEWND_CLASSNAME, NULL);
if (hTraceWnd==NULL)
hTraceWnd = ::FindWindow(OLDTRACEWND_CLASSNAME, NULL);
if (hTraceWnd) {
// Found Trace window: send string with WM_COPYDATA
// Must copy to make me the owner of the string; otherwise
// barfs when called from MFC with traceMultiApp on
//
static char mybuf[1024];
#ifdef _UNICODE
BOOL bDefCharUsed;
::WideCharToMultiByte(CP_ACP,0,LPCWSTR(lpBuf),
-1, mybuf, 1024, NULL, &bDefCharUsed);
#else
memcpy(mybuf, lpBuf, nCount);
#endif
COPYDATASTRUCT cds;
cds.dwData = ID_COPYDATA_TRACEMSG;
cds.cbData = nCount;
cds.lpData = mybuf;
CWinApp* pApp = AfxGetApp();
HWND hWnd = pApp ? pApp->m_pMainWnd->GetSafeHwnd() : NULL;
::SendMessage(hTraceWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
}
// Also do normal debug thing
::OutputDebugString((LPCTSTR)lpBuf);
}
/////////////////
// Initialize tracing. Replace global afxDump.m_pFile with CFileTrace object.
// In VC 5.0, you shouldn't need to call this, since it's called from an
// auto-initializing static object autoInit below. But if you don't see
// any TRACE output in the TraceWin window, you should try calling
// PxlTraceInit any time before your first TRACE message.
//
BOOL CFileTrace::Init()
{
if (afxDump.m_pFile==NULL) {
// Initialize tracing: replace afxDump.m_pFile w/my own CFile object
//
// It's important to allocate with "new" here, not a static object,
// because CFileTrace is virtual--i.e., called through a pointer in
// the object's vtbl--and the compiler will zero out the virtual
// function table with a NOP function when a static object
// goes out of scope. But I want my CFileTrace to stay around to
// display memory leak diagnostics even after all static objects
// have been destructed. So I allocate the object with new and
// never delete it. I don't want this allocation to itself generate
// a reported memory leak, so I turn off memory tracking before I
// allocate, then on again after.
//
BOOL bEnable = AfxEnableMemoryTracking(FALSE);
afxDump.m_pFile = new CFileTrace;
AfxEnableMemoryTracking(bEnable);
return TRUE;
}
return FALSE;
}
//////////////////
// This object does nothing but call CFileTrace::Init, so all you have to
// do is #include this file. Because afxDump is defined in a module with
//
// #pragma init_seg(lib)
//
// afxDump gets initialized before the "user" segment which is where your
// app (and autoInit) is by default. If you need to use init_seg(lib),
// or you have other objects whose constructors call TRACE that get
// initialized before CFileTrace::bInitialized, you will have to call
// CFileTrace::Init yourself, before your first TRACE statement.
//
BOOL CFileTrace::autoInit = CFileTrace::Init();
// This symbol defined so you can call it and have it
// compile to nothing in non-debug build
#define PxlTraceInit() CFileTrace::Init();
#else
#define PxlTraceInit()
#endif // _DEBUG
2011-05-11
XTRACE 外设的VC调试工具
经常在程序的Release版本发现BUG,但Debug版本又查不到,或者是在没有安装开发环境的PC上才能重现该BUG,此时很想看看程序执行过程中的数据情况,于是笔者就想写个程序,能够在Release版本和未装开发环境的情况下也可以使用TRACE的程序,现已完成,且经过很多朋友的使用测试,再此感谢他们的支持与帮助,并祝大家新年快乐!
使用时执行xTraceMonitor.exe,会出现一个小窗口(用于显示数据用),需要将TRACE输出到该监视窗口的程序,请在文件头部使用 #include "xTrace.h",然后将代码中的TRACE修改为XTRACE即可,如果包含了该头文件,控制台程序中也可以使用TRACE宏,而且是输出到VC调试环境的Output窗口中。 为了演示位图的TRACE,特提供一个设备无关位图类CSimpleDib,在文件SimpleDib.h中定义,可以从Bitmap文件中加载位图,也可以从资源中加载。
如果在发行程序时,想去掉这些附加的代码,无须删除XTRACE和#include "xTrace.h"语句,只需要在工程设置中定义NO_XTRACE宏即可,这样xTrace.h文件则犹如一个空文件一般,可执行程序中便没有任何附加代码了。
详细说明请参考xTrace.htm文件。
使用示例代码如下:
#include "stdafx.h"
#include "xTrace.h"
#include "SimpleDib.h"
#include "resource.h"
int _tmain(int argc, _TCHAR* argv[])
{
XTRACE("%s\n", "Hello!"); // 输出文字"Hello!"
XTRACE(RGB(255, 0, 0), "%s\n", "RED Text."); // 输出红色文字
XTRACE(RGB(0, 0, 255), "%s\n", "BLUE Text."); // 输出蓝色文字
CSimpleDib dib;
dib.Load(IDB_BITMAP_TEST);
XTRACE(dib.GetBitmapInfo(), dib.GetBits()); // 输出DIB位图
return 0;
}
第一次使用时请首先执行xTraceMonitor.exe,然后执行需要监视输出的程序,以后则无此要求。
2011-05-11
xzip zip压缩解压缩算法
压缩解压缩算法xzip源码,已有测试程序工程
需要注意的是:这是一个CodeProject上分享的工程,本人在使用的时候发现缓冲区解压的时候总是返回ZIP_MORE的错误,这个情况我没有进一步跟代码确认了,另外首次使用压缩解压缩的朋友,提醒一个要点,对于压缩文件的时间这个问题,如修改时间,如果未被压缩时秒数刚好是奇数,压缩文件修改时间会变成偶数,例如6点30分31秒——》6点30分30秒,这点本人在RAR等压缩软件上测试确实如此,具体原因没去深究。
如果对此工程不放心的可以使用另外一个资源WinCE Zip,使用方式与此Xzip十分类似,上手同样容易,此资源已共享,可在当前用户资源列表中查找!
2011-05-09
银行活期储蓄 VC6.0 oracle数据库 批处理初始化 源代码
银行活期储蓄 VC6.0 oracle数据库 批处理初始化
银行活期储蓄 VC6.0 oracle数据库 批处理初始化
2010-04-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人