Code Samples, Tips, Tricks and
other Neat Stuff for the VB developer

All Content Copyright 2000
New Vision Software
All rights reserved

VB Petition

Many of you may not be aware that Microsoft's mainstream support for VB6 officially ended on March 31st, 2005.  Now that this has occurred, it becomes increasingly more likely that future updates to Windows may break existing VB code.  If you are concerned about this and/or are concerned about migration issues associated with bringing existing VB code to the .NET platform, please take a moment to read and sign the petition asking Microsoft to extend there COM based VB product line.  The impetus behind the petition is the desire to give companies and individuals with substantial investments in existing VB code a path forward to the latest development platform without the current requirement for wholesale rewrites of existing code.  Thanks for your support!




All Sample Projects

Grouped Samples

Common Dialogs

Control Stuff

Date & Timezone




File Routines

Form Modifications

Icon Routines

Listbox & ComboBox




Text Parsing Routines

UserControl Demos

Specific Samples

Activate Previous


API & OLE DragDrop

Environment Variables



Message Box



File Split Utility

Save Clipboard Utility

Visual Basic Tips!

Hit Counter

Hits on this page 

Since January, 2000


Welcome to vbVision where you can find answers to some of life's persistent Win32 API questions.  I would like to thank Felix Kasza for providing the server space for this site.  His generosity is very much appreciated.

If you have visited here recently, be sure to hit the refresh option on your browser since I sometimes make changes to the site on a daily basis.

House Rules

If you use any of the code found on this site, there are some simple rules you must follow.

You may not redistribute any of these samples as "samples" or "demos".  This means that you are free to use the source code in your applications as you see fit but you may not claim that you created any of the sample code or compiled applications found on this site.  It is also expressly forbidden to sell or profit from any of the sample code or compiled applications in any manner other than the knowledge gained and the enhanced value added to your applications. 

If you use any of the source code or compiled applications on this site, you realize that you do so AT YOUR OWN RISK.  The items provided here are supplied AS IS without warranty or guarantee of any kind.

10/4/05  My response to Scoble's blog entry.

1/18/05  Finally, more update activity!

5/6/04  Added another update!

11/14/03  Look below!  Another update!

8/3/03  Look below!  I've updated a couple of demo projects!

11/27/02  Well.... as many may have noticed, there haven't been any new additions here in quite some time.  It is difficult to put a whole lot of effort into creating code samples for what is, in essence, a dead language.  The lack of continuity between VB5/6 and VB.Net is extremely disappointing and is a glaring reminder of what little value Microsoft places on VB code and VB developers.  I am not saying that I will not add new samples or update any of the samples contained here, however, as time passes, the likelihood of additions does diminish.

I continue to be actively involved in the VB5/6 community but, as the future rolls on, I expect to be moving on to other languages as opportunities present themselves.  One thing I can assure is that my future language choices will have the full support of the compiler owner insuring much less danger of existing code assets being made obsolete by arbitrary changes in language syntax such as those that were foisted upon the VB community with the introduction of VB.Net.  As a new language, VB.Net may be fine, but, given the history of VB within the context of 32bit Windows, it is now painfully apparent that creating any code, that may have significant long-term value, in VB.AnyVersion, is foolhardy at best.

To all the thousands of VB5/6 developers that I have come into contact with over the years, I wish you well and good luck in whatever direction your future takes you.  See you online!  -  Regards, Bryan

What's New!

1/18/05  Fixed a couple of bugs in the Super Collection demo.  One that could cause the Keys collection to become out of sync with the contained items in some instances, one relating to collections containing objects and one that could could allow copying of the Keys array beyond the Ubound of the array.  Thanks go to Ben Curthoys for pointing out some of the problems and for his suggested solutions.

1/18/05  Updated the Scrollbars (Windows) demo to allow tracking values that are more than 16bits.  Thanks go to SolarAngel (sorry, they didn't provide their real name) for suggesting the addition and providing the code snippet for the change.

5/6/04  Fixed an omission in the MSDE Installer demo.  It seems that I forgot to remove a reference to an external string handling "helper" library from the project.  Thanks go to Henryk Golebiowski for pointing this out so that I could remedy the situation.

11/14/03  Updated the MSDE Installer demo to reflect the changes in installation methods supported by the MS SQL Server team.  Since custom MSI packages cannot be updated by the latest Service Packs released by MS, this demo now uses the 16 default MSI packages and includes routines to select a package that is not currently installed for installation on the target machine.

8/3/03  Updated the CustomDrawLV demo to include control over drawing of individual subitems.

8/3/03  Fixed a bug in the Super Collection demo that affected the search code for item keys.  Thanks go to Denny Peltz for discovering the problem.

5/22/02  Updated the MSDE Installer demo to copy the callback error reporting library to the path returned by the GetTempPath API function per KB article Q315463.  Thanks go to Paul Garner for tracking down this info!

4/25/02  Added a demo that shows how to create an ActiveX (COM) EXE server.  The demo shows how to communicate with another application via COM calls.  See the Interapplication COM Communication demo for more details.

4/4/02  Added a demo that shows how you can add bolded, default menu items to VB menus.  See the Set Default Menu Item demo for more details.

4/1/02  Updated the Watch Directory demo to provide more info with some notifications.

3/29/02  Added a demo that shows how you can create a custom installer for installing the Microsoft SQL Server Desktop Engine (MSDE) 2000.  See the MSDE Installer demo for more details.

3/13/02  Updated the Proxy For Taskbar demo so that the proxy window is now transparent.

2/19/02  Added an old demo I had laying around that shows how to implement "What's This Help" in a VB project.  See the What's This Help Demo for more details.

1/21/02  Fixed some bugs in the Popup Listbox demo.  Thanks go to Nelson Lopes for pointing out the problems so I could fix them.

12/27/01  Modified the Save And Open File Dialog demo to allow the selection of the initial file view using the SendMessage API function and the undocumented view messages discovered by Brad Martinez.  Thanks go to Brad for allowing the free use of the fruits of his sleuthing work!

9/23/01  Modified the Virtual Listview demo to work with the MSComctl.OCX (VB 6.0) version of the listview.  Also added handlers for getting and setting the TopIndex for the virtual listview.  See the Virtual Listview Demo for all of the details.

9/9/01  Added a new demo showing how to use the TrackMouseEvent API function to create a "popup" button like those found on many toolbars.  The button can display both text and graphics.  See the PopUp Button Demo for all of the details.

8/1/01  Modified the MDI Background Demo to invalidate the client rect before redrawing the image to accommodate for video issues on some systems.  Thanks go to Colin Borrowman for initial research on this problem.



Many of the sample projects on this site make use of the DbgWProc debug DLL.  This makes it possible to single step through subclass implementations without crashing the VB IDE.  Matt Curland, the author of the dll, has generously released the latest version of this file into the public domain and granted permission for it to be available from this and several other web sites.  Thanks, Matt for your dedication to the VB community!  As a side note....  If you haven't read Matt's book Advanced Visual Basic 6, you really are missing out!    See Care And Feeding Instructions For The DbgWProc Debug DLL for information on the use of this library.


Are you tired of fighting the VB collection object?  Have you ever wanted to enumerate the keys in a collection?  Have you ever needed case sensitive keys?  How about the ability to raise events from each item in a collection just like a VB control array?  Have a look in the Collections section for my articles and sample project that replaces the VB collection object.  You can have all of this and still do For Each...Next enumerations!

Other Links & Resources

vbVision is by no means the be all end all site for VB related topics.  Here are some other GREAT resources for VB developers.

Visbas-Beginners E-Mail List

Visbas-L E-Mail List

VBData-L E-Mail List


CodeHound Search Engine

Microsoft's Public Newsgroups

Randy Birch's VBnet

Brad Martinez' VB-32 Programs & Samples

Karl E. Peterson's One-Stop Source Shop

Klaus H. Probst's VB Box

Mattias Sjogren's Samples

Other Visual Basic MVP sites Home

VB Explorer (for VB beginner oriented content)

How To Find The Answers To Your Questions

This section gives some pointers on how to go about finding answers to your VB and API related questions.


The tips section has useful tidbits that may help in your VB projects.  These are items that don't rate a full blown sample project but are none the less good to know.


Search vbVision
only vbVision
all VB sites

Miscellaneous Other Stuff

What's this "MVP"  thingy?  Microsoft designates certain users of their products as MVPs (Most Valuable Professionals).  These MVPs represent a wide variety of backgrounds and professions. What they have in common is strong technical skills in one or more Microsoft products or technology areas, and the willingness to share that knowledge with others.

Disclaimer:  The views and opinions contained within this web site are mine alone and in no way reflect those of Microsoft Corporation (or anyone else for that matter).  Furthermore, I am not, nor have I ever been employed by Microsoft or any of its subsidiaries.

These Web Pages:  This site is best viewed using a table enabled browser on a system where the resolution is greater than or equal to 800x600.

Other "Thank yous"  I want to thank Justin Johnson for providing much of the design of this site and for the initial push to get it going.  Thanks, Justin!!

Feedback:  I would like your feedback about the content on this site and whether or not you find it useful.  Please contact me at with any comments or suggestions you wish to give.  Your input is appreciated!  Please Note:  This link is not a personal help desk.  If you have questions about topics that aren't addressed in the demos supplied on this site (other than suggestions for new demos), please ask them in one of the VB forums listed above so that others might also benefit from any answers you may receive.