Snippets This page was last updated 4th August 2004


With this little function one can send keystrokes to the window that stays on the top. In my application I've searched a window (program) and sent them the keys to get a macro started.

Author: Uwe Gottwald

Here is a snippet of code that deals with the MouseWheel events correctly, taking into account the user setting SPI_GETWHEELSCROLLLINES. The default number of lines to scroll is three.

Often needed sorting routines, Quick, Shell, Heap, Insertion, Selection, Merge, Bubble. Added CombSort 5th Oct 2003


(2k) Demo of using SEH with lcc-win32 using an example from the MS SDK.

Author: MS


(1k) Array2D shows one way to allocate a 2D array.

Author: John Findlay


(1.3k) The SystemReboot function either logs off the current user, shuts down the system, or shuts down and restarts the system. This is layer function to ExitWindowsEx. It ask necessary privilege under WinNT.

Author: Tuukka Lehtinen

Oracle Read
(1.53k) Demo of using ODBC on an Oracle 8 database table.

Author: Rock Cogar


(639bytes) A few macros to mess about with bits.

Author: John Findlay


(7.65k) Two RGN routines, one real and one 32bit integer. (REAL) Generates one pseudo-random real number (double) which is uniformly distributed on [0,1]-interval, for each call. (INTEGER) Generates one pseudorandom unsigned integer (32bit) which is uniformly distributed among 0 to 2^32-1 for each call.

Authors: Makoto Matsumoto and Takuji Nishimura

(827bytes) More messing about with bytes and bits. Reverse bytes and bits.

Code taken from something Chris Torek posted to c.l.c.


(868bytes) Execute a new program, and wait until it ends. This function is generally portable over Win32.

Author: Tuukka Lehtinen


(782bytes) DCDoor contains a routine that will open or close a CD door.

Author: Chris Morse Sebrell

(7.8k) SrWin shows how to save the Window position in the registry and restore the window position from the values stored in the registry.

Author: Tuukka Lehtinen

(5.9k) ClearTop temporarily clears the desktop of all icons. It's ok, you can bring them back.

Contributed by Mike Caetano

(6k) Full Screen Console window.

Author: Mike Caetano


(6k) (UPDATED 10th Jan) MyDel uses SHFileOperation() to move files into the recycle bin.

Author: Alexander Neumeister


(4.4k) Owner draw list box that display colored strings.

Author: Tuukka Lehtinen


(1.37k) Multimapped files copy. Appears to be slower than API CopyFile().

Author: Tuukka Lehtinen


(1.6k) Three LccWin-32 macro-implementations for measuring cpu-cycles:

Author: Heinz van Saanen

Retrieve the name of various system folders.

Launch Explorer starting with a start folder.


Opening a file with its default application

Programmatically Launch a Control Panel Applet

Creates a desktop ShortCut

Launch your App at Startup

Have your App Startup Through the Registry

Routine to load and convert a colour in a small bitmap. (Fixed a DC leak 9th Nov 2002)

When using the routine above to convert a bitmap colour one needs to take into account that 15 or 16 bit screens will not map all colours.

Append Text

A routine to add a line to the end of a multiline edit box using var_args.

Author: Luca Cavalli


SelfDelete() invokes the command interpreter as define by the
environment variable "COMSPEC".  This varies with the OS:
Win9x/ME use COMMAND.COM; WinNT/2K/XP use CMD.EXE.

SelfDelete() should be called only at the program's exit. Make sure all processes/threads have finished and all handles are closed before calling the function.

Author: Tony Varnas


IsGuiApp.c determines if an application is GUI (windows) or CUI (console).

Author: MS Knowlagebase


(4.7k) ListView example showing how to add a Manifest.

Author: MS


(8.0k) UPDATE (15th July 2004) precise_time shows how to have a more reliable timer under windows.

Author: Andreas Martin

(2k) Add to startup folder. Provides a function to add the current program to the startup folder as a shortcut. Also shows the correct method to get a shell folder path.

Author: TMouse

(2k) Hash data Provides functions to generate MD2, MD4, MD5 and SHA1 hashes from input data.

Author: TMouse


(2k) Map File Read
Provides a simple function to memory map an existing file for reading.

Author: TMouse

(2k) Enable Process Privilege. Provides a function to enable or disable a process privilege. Functions are dynamically loaded to avoid problems on Win9x.

Author: TMouse

(2k) Save and read UTF8 files. Provides functions to read and write UTF8 files, the de-facto standard for international text and web pages.

Author: TMouse

Back to main page