Karl E. Peterson - vb.mvps.org


Hard to believe it's been over three years since I put up this new design. I'm afraid the proverbial "dust" still hasn't fully settled. Wish I had more time to put into this. Hard to get as enthusiastic as once was possible, I'm afraid, given the horrible  destruction done. Seems that the general consensus is starting to swing, though, back towards "maybe Classic VB wasn't so bad after all." VSM has decided there's enough interest still that, for the time being at any rate, they're going to revive my old column! There are links to all of them over on the Articles page, but here's the jumping off point to them on the VSM site:

Classic VB Corner  <<== new Classic VB column!

The code sample offerings have gone under the most redesign of all. Whereas they used to be listed on a single page for all, you will now find a descriptive page for each! Unfortunately, it's going to take a bit more time to get the descriptions updated for all those projects, so I've copied the old page over for your reference.

This site is totally devoted to Classic Visual Basic, as millions once knew and loved it. This is a certifiably .NET-Free zone..NET: It's About Trust!

What's New

July 29, 2010
  • Added the KeyStuff code sample. Shows how to stuff the keyboard buffer from a console application. Includes the full source code for a command line utility (CDW) that you can use in place of CD to change directories using a browse for folder dialog.
June 28, 2010
  • Updated the Uptime code sample. Added the capability to call OpenProcess against system processes in Vista and Windows 7, by elevating to debug privileges in the current process. Also renames the CProcessInfo class to CProcessTimes, as that seemed more accurate..
April 26, 2010
  • Added the StartupInfo code sample. Provides a drop-in ready class module of various startup parameters requested by either the user or the calling process.
  • Updated the StopWatch code sample. Added an actual test app that shows how to time a hypothetical comparison between exponentiation and multiplication. Plus, another little demonstration of the (what I consider) the unreliabilty of QueryPerformanceCounter as an alternative to timeGetTime for benchmarks.
April 2, 2010
  • Updated the SendInput code sample (again). Found the need to add support for the AltGr key, which is supported natively by the operating system when it's using certain (non-US) keyboard layouts.
March 10, 2010
  • Added the MemStatus code sample. Shows how to determine the total and available amounts of installed physical memory, application virtual address space, and page file swap space. Also demonstrates how to go beyond the standard 2gb Win32 virtual address space limit in properly configured systems.
February 17, 2010
  • Updated the Console code sample. The method used to determine LaunchMode, by looking for known or suspected parent processes, was failing on x64 systems. Fixed that.
December 21, 2009
  • Updated the SendInput code sample (again). Turns out CAPSLOCK did bad things to the input string, so we had to compensate for that with a quick test and correction as needed.
December 16, 2009
  • Updated the SendInput code sample. Fixed a problem with high-order ASCII characters that didn't have a direct translation to specific keystrokes. Added support for a couple of weird exceptions, such as "~" and "{}}".
November 17, 2009
  • Added the SysInfo code sample. This one hooks the hidden top-level window that's present in every Classic VB app, to sink notifications whenever devices are added or removed from the system, when system settings change, and system power notifications.
November 3, 2009
  • Added the Streams code sample. Here's a drop-in ready class module that will enumerate Alternate Data Streams within any NTFS file or folder. It also offers a Kill method, since VB's native one croaks on ADS.
September 24, 2009
  • Added the Assoc code sample. Shows how to use AssocQueryString to return all sorts of useful information about any given file type. This API is far and above more useful than FindExectuable..
  • Updated the Which code sample. Added a "backup" method for finding the application associated with any given document filetype, due to a bug with the FindExecutable API and certain 5-letter file extensions.
August 26, 2009
  • Added the Which code sample. This is a simple console utility that finds any or all matching executable files on the search path, so you can sort out what's running if you have multiple copies installed. Will also find the executable associated with any existing document file.
August 7, 2009
  • Updated the Monitors code sample. Added numerous routines that will help restoring a window to a persisted position, including checks on whether that position is still onscreen (visible) and so on.
July 24, 2009
  • Updated the HookXP code sample. Added two new class modules that provide MouseWheel events and MouseEnter-MouseHover-MouseLeave events.
  • Updated the SendInput code sample. Added a few conditional constants that were undefined in VBA.
July 15, 2009
  • Updated the HookXP code sample. Changed the auto-unhook trigger from WM_DESTROY to WM_NCDESTROY. Stupid typo oversight.
July 2, 2009
  • Added the HookXP code sample. This shows how to subclass any window in your process, using a method built into Windows! Very slick, safe, and incredibly flexible. Will be featured in upcoming VSM Online column, and will definitely be enhanced as time goes on. One you'll want to be familiar with.
June 24, 2009
  • Updated the Console code sample, adding another demonstration program which modifies system environment variables. Also, generally re-organized the entire download, renaming the included projects and modules to make it easier to identify which was which, and recompiled all samples using VB6.
June 23, 2009
  • Updated the Uptime code sample, patching a critical error in the MRegCalls.bas file. If you downloaded this file before this date, please discard and redownload. The RegDeleteValue function calls the wrong API, as a result of a hasty cut/paste error, and instead recursively deletes an entire key. I cannot urge caution here strongly enough, which may be best illustrated by the fact that this is the first time in the nearly 12 years this site has existed that I've published such a routine. <sigh>
June 22, 2009
  • Updated the DualList code sample, adding another custom control to the project. The new ReorderList control contains a standard ListBox and two Command buttons, offering your user the opportunity to reorder the elements within the list by moving them up and down.
May 19, 2009
  • Added the StockFont code sample. Demonstrates a very simple way to use the old-fashioned block drawing characters by selecting a stock font (one that ships as part of Windows) into any control.
May 5, 2009
April 9, 2009
  • Added the Uptime code sample. This shows how to determine when the computer its running on was last rebooted. Actually two methods. One retrieves the last proper shutdown time, and the other retrieves the startup time.
March 31, 2009
  • Peter Young has granted permission for me to host vbAdvance, which is now freeware. Folks, this is the only add-in that I always have loaded in my IDE. You really shouldn't be with out it. It's officially "unsupported," but if you can read the help file and follow along with the packaged examples, you should get along just fine.
Comprehensive Updates List

Odds and Ends

Here are a few offerings you won't find linked to in the main menus on this site, but that I'd like to make sure you were aware of regardless. 

Hardcore Visual Basic, by Bruce McKinney
When Microsoft decided to drop Bruce's classic tome from MSDN, I quickly offered to host it here at MVPs.org and, against what I considered all odds, they agreed. I'm glad we could save this one, and make it available to everyone from here onward. More recently, this site assumed the honor of hosting The End of Hardcore Visual Basic, a fond farewell to what was.
Visual Basic 4 How-To
Several of us put  together this little tome in 1994-95, during the world's longest beta. I don't believe there ever was a fully electronic copy suitable for online publishing, at least I never encountered one. While much of the text is now somewhat obsolete, the code may still contain a few tricks.
Site Statistics
Call it vain, or whatever. In case you care, here are a few stats taken over the years. I hope to provide a more up-to-date selection of frequent downloads once this new site stabilizes.
Those Awful Midis
Okay, it took three (or more?) years, but I finally rolled out a new site that isn't a throwback to the 90s. If you actually miss those old Pink Floyd midi tunes, don't fret! They're still here.


After great agonizing, I have decided to plop a PayPal Donations button down on the bottom of every page here. The simple truth is, Visual Basic Programmer's Journal used to (unwittingly?) finance this site by commissioning my articles on Classic VB. Sadly, that publication is no longer with us, and the one that's taken its place isn't much interested in the programming language you and I still use. So, long story-short, if I've saved you (or your boss!) a bundle of money with the code you've downloaded from here, and you're feeling generous (or you have access to the company credit card!), well, I'm not too proud to let you help me defray the time I spend building the samples offered here. Thanks!