Visual Basic Source Code

Examples For VB3 and VB4/32-VB5-VB6

All of the following samples were written by Don Bradner, and are provided for the benefit of other programmers. All of the samples are provided As-Is, with no warranty expressed or implied.
VB3 samples. These samples illustrate 32-bit functions that normally cannot be done from 16-bit programs. They accomplish the feat through the use of a 16/32 thunking layer; in this case a public-domain DLL named CALL32 is used for the translation. Probably work with VB4/16, but not tested.

TASKBR.ZIP - Put icons in the Taskbar Notification Area, also known as the Taskbar Tray. Modify the icons, delete them, show tool tips, and respond to mouse events. Includes MsgHook.VBX for receiving messages.

REG32.ZIP - read and write Win95/NT registry values beyond the single Main Key allowed with 16-bit calls. Enumerate values, and work with multi-value keys.

CALL32.ZIP- CALL32.DLL, required for the samples above. NOTE: At the time CALL32 was written, it was not compatible with "Chicago," so the documentation says it is NT only. As Win95 evolved it became compatible, so the documentation is in error. CALL32 works with all versions of 32-bit Windows.
VB4/32-VB5/6 samples. Source code for some interesting problems.

SUBCLASSED FILE DIALOG. The code presented here is amplified a bit from that which accompanied my article in the January '98 Visual Basic Programmer's Journal. This code demonstrates 1) a common dialog displayed without using the Comdlg32.ocx, and 2) subclassing of that dialog to place custom items on the dialog and to interact with it. The modified version presented here also demonstrates using the file dialog as a Folder Browser/Chooser. Advantages over the SHBrowseForFolder include a better look (which you can customize), better control over starting folder, and the ability to create folders within the dialog. Get the Source Code here (VB5/6).

In an issue of Microsoft Developer Network News, in response to a question about what is required to produce a (32-bit Windows) screen saver, "Dr. GUI" responds in part: "1. To write screensavers for (32-bit Windows), you'll need the Win32 SDK. 2. Dr. GUI recommends using C++ for this task. You'll need C++ or at least C to interface with Windows...." The good doctor has presumably never seen our sample!

JDSAVER - A fully functional code sample that implements all of the Win95/NT4 screen saver functions (/s /c /p /a). Puts a preview copy in the Display Properties Dialog, implements password protection, etc. A joint collaboration between Don Bradner and Jim Deutch. Available in VB4 and VB5/6 versions. JDSAVER.ZIP is the VB4 version and requires COMCTL32.OCX from VB4 pro. Also requires MsgHoo32.OCX, available in the MsgHook package below. JDSVRVB6.ZIP is the VB5/6 version, and requires no OCXs to work. Subclassing is handled with the AddressOf operator. Updated 8/20/2001.

TASKBAR - Put icons in the Taskbar Notification Area, also known as the Taskbar Tray. Modify the icons, delete them, show tool tips. Another sample that has VB4 and VB5 versions. TSKVB4.ZIPis the VB4 version, requiring COMCTL32.OCX from VB4 pro and MsgHoo32.OCX, available in the MsgHook package below. TSKVB5.ZIP is the VB5 version, requiring no additional files.

MSGHOOK.ZIP - Contains an executable file that installs both the 16 and 32-bit versions of MsgHook. Courtesy of Zane Thomas, Mabry Software, and Waite Group Press.

REGVB4.ZIP- Most registry functions are demonstrated in the form of a functional registry editor, ala REGEDIT.EXE. Not intended to replace REGEDIT, but simply to demonstrate the functions. Req COMCTL32.OCX from VB4 pro.

REGVB5.ZIP- Same as REGVB4, but fixes problems that make that file not work correctly in VB5. Req COMCTL32.OCX from VB5 pro.

Read and write to any registry value! Why be limited to getsetting when you need information in the registry? Here is source for a registry read function limited only by your access permissions.

Similarly, here is source for code to write any value in the registry.

ICONXT.ZIP - demonstrates the extraction of large and small icons from an .EXE file that is not running.

Comments? Send mail to donb@arcatapet.net
Snail Mail: Arcata Pet, 600 F Street, Arcata, CA 95521-6301 USA
Webspace provided by and ©Copyright 1994-2013 by Arcata Pet Supplies. All Rights Reserved.