| Code Sample Page | View
Guestbook Sign
Guestbook |
Everything here compiles with Visual C++ 6 and probably
Visual C++ .NET also.
|
MFC CODE |
||||
| CDialogResize |
Download: resizedialog.zip Version 1.0 Size: KB Updated: March 4th 2004 |
Changes
to CResizeDialog: - Support for CFormView - Now using CSubclassWnd |
||
| CCoolBtn |
Download: splitbtn.zip Version 1.0 Size: 23KB Updated: 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: formview.zip Version 1.0 Size: 30KB Updated: 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: keyboard.zip Version 1.0 Size: 27KB Updated: 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: zip.zip Version 1.0 Size: 315KB Updated: 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,iowin64.zip) - 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: edit.zip Version 1.0 Size: 43KB Updated: 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: status.zip Version 1.0 Size: 29KB Updated: nov. 6th 2001 |
If you don't like CStatusBarCtrl::SetIcon, then
this might be for you.
Demonstrates: |
![]() |
|
| CImageEditWnd | Download: imagedit.zip Version 1.1 Size: 50KB Updated: sept. 27th 2001 |
Based on http://www.bcgsoft.com
-
imageeditdlg.cpp
Simple bitmap editor. Also capable of editing "sub-bitmaps". Also demonstrates: |
![]() |
|
| CTelnetServer | Download: telnet.zip Version 1.0 Size: 20KB Updated: aug. 16th 2001 |
Straight MFC telnet server implementation. Unicode-enabled. | ||
| Console | Download: console.zip Version 1.0 Size: 6KB Updated: aug. 17th 2001 |
Based on http://codeguru.earthweb.com/misc/console2.shtml
Console app using CWinApp/CCommandLineInfo. Unicode-enabled. |
||
| CxMemDC | Download: bitmapdc.zip Version 1.0 Size: 7KB Updated: aug. 17th 2001 |
Based on http://www.codeproject.com/gdi/flickerfree.asp
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: |
||
|
CHexDoc / View |
Download: hexdump.zip Version 1.0 Size: 22 KB Updated: 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: match.zip Version 1.0 Size: 14KB Updated: 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. |
||
|
C CODE |
||||
| ioapi |
Download: ioapi.zip |
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... |
||
| unarj |
Download: unarj.zip |
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: qsort.zip Version 1.0 Size: 4KB Updated: Aug. 17th 2001 |
Kernighan & Ritchie-derived qsort implementation, with a few more parameters. Win32+MSDOS projects. | ||
| StrFormatByteSize64 | Download: bytesize.zip Version 1.0 Size: 10KB Updated: 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. |
||
| CFGAPI |
Download: cfgapi.zip Version 1.0 Size: 33KB Updated: April 14th 2004 |
A
generic profile interface. Access ini-files and registry profiles using
a single API. |
||
| Portable Object Orientation in plain C | Download: ooinc.zip Version 1.0 Size: 10KB Updated: 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) { ... fclose(stream); stream = NULL; } |
handle
= _findfirst(); if (-1 != handle) { ... _findclose(handle); handle = NULL; } |
| HANDLE
file = CreateFile() if (file != INVALID_HANDLE_VALUE) { ... CloseHandle(file); file = NULL; } |
HWND
m_hWnd = CreateWindow(); ... DestroyWindow(m_hWnd); m_hWnd = NULL; |
|||
| ISOLIB |
Download: isolib.zip Version 1.0 Size: 28KB Updated: 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. |
||
|
CONTRIBUTIONS TO OPEN SOURCE PROJECTS |
||||
| TVision | Download: tv203s-ide.zip Size: 1.58 MB Version 2.03s Updated May 9th 2005 |
Added project files for MSVC and Code::Blocks. Renamed .cc files to .cpp. | ||
| FreeExtractor | Download: makesfx.zip Version 1.44X Size: 413 KB Updated: 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: cximage.zip Version 1.01X Size: 1.31 MB Updated: aug. 28th 2001 |
Based
on http://www.codeproject.com/bitmap/cximage.asp by Davide Pizzolato et al, version 1.01. Superseeded by http://www.codeproject.com/bitmap/trans_cimage.asp |
||
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