Code Sample Page View Guestbook    Sign Guestbook

 Everything here compiles with Visual C++ 6 and probably Visual C++ .NET also.


Version 1.0
Size: KB
March 4th 2004
Changes to CResizeDialog:
- Support for CFormView
- Now using CSubclassWnd

Version 1.0
Size: 23KB
Nov. 7th 2003
Changes to Cool Push Button:
- Using OBM_COMBO bitmap arrow
- Enabled use of popup menu resource
- Popup menu using keyboard (VK_DOWN)

CFormMDIChildWnd / CFormView_Indirect Download:
Version 1.0
Size: 30KB
June 18th 2003
Fun with CFormView!
Paul DiLascia described how to center CFormView in MSJ (Oct. 1996). I take it a little further here:
- Added scroll bars!
- Moved code from CFrameWnd to CMDIChildWnd
In this sample I also show how to create a formview with no dialog template (CFormView_Indirect).  
CKeyboardDialog Download:
Version 1.0
Size: 27KB
May 23th 2002
Adjustments to Onscreen Keyboard by Randy More
- Special edit control focus handling
- Prepared for modeless keyboard dialog variant
- Programmatically creating dialog template 
CZip / CUnzip / CMFCZip / CMFCUnzip Download:
Version 1.0
Size: 315KB
August 3rd 2004
- Simple C++ wrapping of Gilles Vollants zip code (version 1.01).
- Extended C++ wrapper using MFC (CFile/CMemFile)
- Simplified interface to crypt.c (contrib/cryptx.h) + demonstration (app.cpp)
- Implementation of proposal: unzAttach/unzDetach
- Demonstrates decompression of memory-based zipfiles (iomem.c/iomem_simple.c)
- Implementation of proposal: unzValidate (with crc-check)
- Implementation of proposal: 64 bit file operations (ZPOS_T,ioapi64.c,
- Academic exercise: ioapi-wrapper for zipWriteInFileInZip/zipCloseFileInZip and unzReadCurrentFile/unztell/unzCloseCurrentFile
Note: Debug build is 64 bits (sets ZPOS_T=ZOFF_T=fpos_t), other builds are default (ZPOS_T=uLong)
CEditView / CRichEditView Download:
Version 1.0
Size: 43KB
dec. 14th 2001
The edit-views are easy to use, but lacks some basic functionality. This sample demonstrates a few CEditView and CRichEditView enhancements:
- Plain text in CRichEditView
- CFontDialog (enhanced)
- Unicode
- Win16 
CStatusBarBitmap Download:
Version 1.0
Size: 29KB
nov. 6th 2001
If you don't like CStatusBarCtrl::SetIcon, then this might be for you.

- Bitmaps in status bar
- Multiple 'states' in a single bitmap
- Tooltips for status bar
- Calculating pane size
- Handling mouse clicks on status bar
- Time in status bar
- LoadImage API
- Unicode

CImageEditWnd Download:
Version 1.1
Size: 50KB
sept. 27th 2001
Based on - imageeditdlg.cpp

Simple bitmap editor. Also capable of editing "sub-bitmaps".
Based on CBCGImageEditDlg and CImagePaintArea .

Also demonstrates:
- CToolBar embedded in dialog (CPropertyPage)
- CToolBar tooltips in property sheet
- CToolBar based on dynamically created bitmap

CTelnetServer Download:
Version 1.0
Size: 20KB
aug. 16th 2001
Straight MFC telnet server implementation. Unicode-enabled.
Console Download:
Version 1.0
Size: 6KB
aug. 17th 2001
Based on

Console app using CWinApp/CCommandLineInfo. Unicode-enabled.

CxMemDC Download:
Version 1.0
Size: 7KB
aug. 17th 2001
Based on

CxMemDC class, derived from slightly modified CMemDC, can act as a memory-based bitmap DC. Sample program makes a drawing in memory and paste it to the clipboard.

Changes in CMemDC (base) class:
- 'private' is bad
- Pointer to RECT in constructor is bad

CHexDoc / View

Version 1.0
Size: 22 KB
nov. 20th 2001
Jeff Prosises simple hex-viewer (MSJ Apr. 1996). Brushed up. Utilizing more of the basic MFC facilites.
Info-ZIP's match Download:
Version 1.0
Size: 14KB
June 19th 2003
Wildcard string match might not useful to all and everybody, but it was a lifesaver for me...
Here's a little test program.
I do a little dance around match.c to make it understand Unicode.

In this section projects are included for Visual C++ 6, Visual C++ 1.52 and  MinGW Developer Studio


Version 1.0
Size: 15KB
May 17th 2004

Gilles Vollants' ioapi is ultimate code in respect of versatility and simplicity, the finest of code qualities. Please study it. Say goodbye to CreateFile, _lopen, CFile.Open, CStdioFile.Open, fopen, _open and the rest...
Here I supply an Unicode variant of ioapi. Plus a few new functions: zgetlength_file, zgets_file. And a wrapper class (ioapi.hpp).
I also introduce a new interface: The Find file API (ffapi). Generic _findfirst/_findnext interface, implemented much like ioapi.
You can get the basic idea from reading these files:
ioapi: ioapi.h ioapi.c
ffapi: ffapi.h ffapi.c
More ioapi right below...

Version 1.0
Size: 140KB
May 17th 2004

Here Robert Jung's unarj demo is given the ioapi treatment (see above).
- Uniform file access: ioapi is also used to access the compressed files, inside the archive.
- Unicode.
- Utilizing ffapi (see above).
qsort Download:
Version 1.0
Size: 4KB
Aug. 17th 2001
Kernighan & Ritchie-derived qsort implementation, with a few more parameters. Win32+MSDOS projects.
StrFormatByteSize64 Download:
Version 1.0
Size: 10KB
April 14th 2004
An alternative take on the Win32 function StrFormatByteSize64, ie. format the value 1440000 as "1.37MB". You can specify number of significant digits. It's implemented using regular C runtime library calls, using the double type. Did I get it right I wonder? Please drop me a word if you know how to implement it using plain integer arithmetics.
Version 1.0
Size: 33KB
April 14th 2004
A generic profile interface. Access ini-files and registry profiles using a single API.
Portable Object Orientation in plain C Download:
Version 1.0
Size: 10KB
April 29th 2003
Do you recognize the examples to the right? Using "handles" is neat - and it greatly facilitates creating C++ wrappers later on.
See in this code example how the I like it done...
stream = fopen();
if (stream)
   stream = NULL;
handle = _findfirst();
if (-1 != handle)
   handle = NULL;
HANDLE file = CreateFile()
   CloseHandle(file); file = NULL;
HWND m_hWnd = CreateWindow();
m_hWnd = NULL;
Version 1.0
Size: 28KB
July 13th 2004
Sergey Oblomov's .iso image reader is open-source, but tied in with Total Commander.
I think it deserves to be a lib, for C programmers to use in their programs.
- Replaced Windows heap allocation with regular C allocation.
- #pragma pack() protection of structures
- Ported from .cpp to .c
- CreateFile -> fopen (-> ioapi later)
- C_ASSERT(sizeof)
- Fixed a bug (marked with BUG)
- Utilizing ffapi (see above)
Unicode - no file name string conversions at all in Unicode build
- iso_attach/iso_detach
- Added demo program (C++)
 Future: I might give it the ioapi-treatment. Perhaps add writing capability.


TVision Download:
Size: 1.58 MB
Version 2.03s
May 9th 2005
Added project files for MSVC and Code::Blocks. Renamed .cc files to .cpp.
FreeExtractor Download:
Version 1.44X
Size: 413 KB
Dec. 12th 2003
Extension to the FreeExtractor. Copyright 2000-2001 Andrew Fawcett.

Changes to MakeSFX:
- ini-file on command line. Took Default.ini and extended it a bit.
- Upgraded components (upx, zlib, unzip) to current versions
- Shortcut option: added an extra pipe: "app.lnk|app.exe|parameters"
- changed directory structure, to make backup excluding temporary files slightly easier (.\obj, .\output -> .\bin,.\debug,.\release)
Arnold   Extensions to the Arnold CPC emulator. Copyright Kevin Thacker 1995-2001.
Follow this link.
CxImage Download:
Version 1.01X
Size: 1.31 MB
aug. 28th 2001
Based on by Davide Pizzolato et al, version 1.01.

Superseeded by

Unicode in Windows:
From the dawn of man and up till Windows 9X, Disk Operating Systems (and windowing systems) used 8 bit character strings (char in C), internally and externally, for filenames and everything else. This, I can tell you, caused some grief in countries with 'national' characters, i.e. the entire non-English-speaking world. Windows NT/2000/XP uses 16-bit character strings (wchar_t in C), internally and externally (Unicode), but continues to have complete support for 8 bit character strings, for applications that uses char. I know of very few applications that are actually using wchar_t, but when writing reusable code you can at least keep the window open for the foreigners. If you don't provide dual APIs (char + wchar_t), then at least replace char with the TCHAR macro (and use sizeof(TCHAR) a bit).  Then people will have the option. Don’t forget the coders out in China and Japan!
Why do I care? Well, I just like generic code. Who doesn't? And I would like the days when national characters got garbled all the time to be long gone and never ever return...

Note: STL/MFC/ATL are Unicode enabled. COM is inherently Unicode. HTML is not Unicode.
More... Unicode in Linux...



This page © Troels K. Updated May 9th 2005