Additional Visual Basic 5.0 & 6.0 Samples
These are additional Visual Basic 5.0 and 6.0 samples, controls, utilities and components. Samples marked with "VB6" are intended to be run only in Visual Basic 6.0 and those marked with "VB5" are intended for Visual Basic 5.0 only. All samples on this page that offer a single file download are Intel-x86 versions. Samples that offer two file downloads provide a choice of Intel-x86 (listed first) or Alpha (listed second) versions.
This utility will upgrade your Visual Basic 5.0 and pre-release 6.0 projects to use the latest Visual Basic 6.0 ActiveX controls. Specifically this utility will update any project that contains any of the following ActiveX controls: COMCTL32.OCX, COMCT232.OCX, MSChart.OCX. Note: Before using this utility you should backup your Visual Basic 5.0 projects. Do not convert projects using binary compatibility.
This download includes the document "Revised Binary Compatibility" as well as the Add-in SyncCompt.dll. Binary Compatibility as implemented in Visual Basic 5.0 and Visual Basic 6.0 ensures that new versions of shipping products are fully compatible with older versions. The document explains issues around Binary Compatibility and GUID revision and introduces the DLL. The DLL add-in builds a new compatibility file to stabilize your product (except Standard EXE's which do not have binary compatibility). This tool only works in an Microsoft Windows NT® environment.
The soft button control mimics the behavior of the buttons in the Microsoft Office 97 toolbar. The soft button control will paint a specified bitmap, using the user provided mask color. When the button is disabled, it will apply the "embossed" or "disabled" effect to the picture. The soft button only has a 3D edge when the mouse pointer is over it or when it has received focus through keystrokes.
Web Buttons are ActiveX controls that allow web developers to create interesting, unique user interfaces. They bridge the gap between the immediate response of an HTML form button, and the smooth, graphical look of a client-side image map.
Web Buttons have a gradient texture that mimics the appearance of the textured molded plastic buttons used on car stereos and remote controls. This effect is achieved by creating a custom, gradient bitmap that is stretched at run time to fit the button.
One kind of Web Button is the "push button," which is a rounded button with a charcoal gray, matte finish. It has separate captions for each state (True/False) that can be displayed in any color that the system supports. An ellipse around the edge of the button smooths the jagged edges of the gradient bitmap. Like the caption, this ellipse can be any available color.
The "rocker button," an elliptical object with a charcoal gray, matte finish, is another Web Button. Inside the elliptical object there are three regions. The upper region is a thumbnail-shaped button that contains a sunken, triangle-shaped LED. The middle region contains the button's caption, which can be any available color. This region is not clickable. The lower region is a thumbnail-shaped button that contains a sunken, triangle-shaped LED. An ellipse around the edge of the button smooths the jagged edges of the gradient bitmap. Like the caption, this circle can be any available color. When you click on either button, the LED in that region lights up.
The Dial control is a circular slider control, similar to a volume knob found on a stereo system. The Dial control has two modes: limited and non-limited.
In limited mode, the "min" and "max" values determine the limits possible within one revolution. The dial can be turned only one revolution. In the non-limited mode, the "min" and "max" values set the range of the dial in one revolution.
The dial can be turned unlimited revolutions. The limited mode could be used to adjust a value between two extremes say 1 and 100. The non-limited mode could be used to determine how much adjustment is possible in the margins of a page. Each revolution could equal one inch.
The Directory Walking Control (Dir Walk) is an OCX which can be used as either a control placed on a form, or as a standalone ActiveX server using the CreateObject method. It is used to collect information from a directory tree. Whenever a file matching the specified criteria is found, it fires an "ItemFound" event. It will continue to walk the tree until either the entire drive is searched, or the fCancel parameter on the ItemFound event is set to True.
The LED control emulates an LED (light-emitting diode), such as those found in digital clocks and displays. The seven-segment display can be used to indicate numeric or user-defined values.
Developers can either set the display by assigning the numeric number to the value, or set a mask value, and the display will only show the segments that the mask specifies. This allows the user to create unique display items, such as an underline or dash, that are not defined by a numeric value.
IContextMenu Shell Extension is a sample that demonstrates how to build a Visual Basic 5.0 DLL that creates, implements, and registers three system interfaces (IShellExtInit, IContextMenu, and IDataObject) that interact with Windows Explorer.
This sample shell extension enhances the shell by adding custom commands to the context menu for all .ini files. Sample code for an INI file viewer has been provided that is run by the shell extension when the user right clicks over any file with the .ini extension and selects the option to view INI file. This sample uses the new Visual Basic 5 Implements feature to create system callable interfaces.
Note: This sample requires the release version of Visual Basic 5.0 Professional or Enterprise Edition.
The SysTray ActiveX control (.ocx) demonstrates how to add icons to the taskbar status area of Windows and how to process callback messages for taskbar icons. The application's callback messages are received and processed in a basic module that is registered as a callback function in a Win32 API call by using the new Visual Basic 5.0 AddressOf feature.
The Data Access Explorer (DAE) provides Visual Basic developers with the ability to evaluate the different data access options provided by Visual Basic 5.0.
Using queries and sample data provided by the National Software Testing Laboratories, developers can select a combination of queries, data sources, query methods, and database engine options to explore Visual Basic's data access capabilities. As tests are completed, DAE displays the time required for each data access option. Those results can be viewed from within the DAE test window or as a text file.
An "Export To Excel" option is provided for those using Excel.
Visual Component Manager
Visual Component Manager is a tool for publishing, organizing, searching, and sorting reusable Visual Basic components such as controls, designers, samples, templates, and wizards. You can use the Component Manager to publish components you author to a wider audience. You can also organize all your components in one place and easily search attributes such as keywords, property values, descriptive text, etc. The Component Manager is implemented on the Microsoft Repository. V1.0.
Visual Modeler is a graphical object modeling tool that is tightly integrated with Microsoft Visual Basic 5.0. Visual Modeler allows you to fulfill the promise of object-oriented programming by quickly and easily creating applications that are maintainable, have a long lifetime, and are comprised of components that can be reused in other applications.
These are the main features of Visual Modeler:
- Class diagrams where you describe the design of the system you are about to develop in terms of a model, using a high level of abstraction.
- Code generation lets you automatically generate Visual Basic code from the design model you have created with Visual Modeler.
- Reverse engineering lets you automatically create or update the model with changes made to the Visual Basic code.
- Round-trip engineering which is the combination of modeling, code generation, coding, and reverse engineering.
Visual Modeler is available from either the Microsoft Visual Studio or Microsoft Visual Basic Owner's Areas. This paper describes how Microsoft Visual Modeler works in either the Microsoft Visual Studio or Microsoft Visual Basic Enterprise Editions. Microsoft Visual Modeler is a tool to help visualize application component designs. It is capable of reverse- engineering existing Visual Basic applications to create a model. Or, starting from an existing model, it can build the Visual Basic prototype code used to implement a model.
Microsoft Active Messaging (formerly called OLE Messaging) is an object ../Library for building messaging and collaboration applications. It is a technology designed to simplify the creation of applications with messaging functionality, or to add messaging functionality to existing applications.
For example, Active Messaging enables you add script to a Visual Basic application or web site to provide support for creating, sending, and receiving e-mail as well as participating in discussions and other public folder applications.
Active Messaging does not represent a new messaging model, but rather is an additional scripting interface to the Messaging Application Programming Interface (MAPI) model.
The MSChart control allows you to plot data in charts according to your specifications. Create a chart by setting data in the control's properties page, or by retrieving data from another an external source, such as a Microsoft Excel spreadsheet. Use the GetObject method to reference the path to the Excel workbook that contains the worksheet.
The MSChart control has many visible parts, all of which can be programmed. Use the MSChart control's three-dimensional chart features to lend a certain sparkle to a report. In order to see these features, you must either set the ChartType property to a valid 3D type, or set the Chart3D property to True.
The Visual Basic About/Splash sample is a form combining the functionality of an About Box and a Splash Screen into one form. Since the majority of information contained in these two forms is usually identical, it makes sense to combine the forms to reduce coding and provide uniformity. The form also has optional parameters of User Name and User Info. This allows the programmer to pass program-specific registration information, which might be different from the user information stored in the system registry.
The Visual Basic ActiveX Document Debugger Sample is a utility that works directly with the VB5 IDE. It's purpose is to ease the development process for ActiveX Document developers. It does this by acting as a dockable ToolWindow that provides automatic loading and unloading of ActiveX Documents into selected hosts.
The ActiveX Document Debugger provides two drop down combo boxes and two buttons. The comboboxes load a selected ActiveX document into one of three hosts. The buttons start and stop the process.
The Paint Effects Tool contains a PaintEffects class that provides methods for painting transparent and disabled (embossed) images. The sample includes a demonstration of all methods.
This feature clears the Immediate Window with the click of a button. Installing this Add-In adds a button to the Standard Toolbar and a menu item to the Add-Ins menu. The sample code must be compiled and registered in order to create this feature.
Changes have been made to the API Viewer data. Download Win32api.exe which contains these changes. After you've downloaded the file to your machine double click on it. It will be decompressed and copied to the correct folder.
Microsoft Visual Studio owners have access to these docs in Books Online. They do not have the documents which were included on the Microsoft Visual Basics CD in the Docs folder. If you want the doc files which are easier to print, download this file.
The Visual Basic Event-Spy sample is an Add-In for the VB5.0 development environment. It can be used to more clearly identify where and when IDE Events are triggered. The sample code must be compiled and registered in order to create this feature.
Visual Basic Template Manager Add-In
This is an update to the Add-In that was shipped on the CD under /Tools/Unsupported. The Template Manager is a Visual Basic Add-In which provides three new template types to Visual Basic. With the Template Manager, you can use Code Templates, Menu Templates, and Control Set Templates. These templates are copied to the \Template folder beneath the Visual Basic root folder. They are accessed in the same manner as you would create any other template.
This control allows you to display the database schema for an Access MDB file in a treeview. Simply by setting the DatabaseName property you will fill the treeview with a list of the tables, queries, properties, fields, and indexes in the database. You can then browse the schema, rename objects, and modify property values. You can also right click to get a context menu that allows you to open a different database, refresh the treeview or, browse the data in a table.
This sample is a scrollable ListView-type collection of the current Windows System Colors. It could be easily modified to display icons, bitmaps, or whatever you have in mind. It currently displays a 3D box filled with a system color next to each system color name. It is mostly hard-coded, using only a scroll bar, so it is very flexible and lightweight.
The PropPick.dll contains the PropertyPicker class, which wraps the OleCreatePropertyFrame API with the property pages CStockColorPage and CStockPicturePage that come in Msstkprp.dll. You can use these property pages in a UserControl, by simply adding them to the UserControl's PropertyPages property. To invoke the pages in code, the OleCreatePropertyFrame API must be called to provide a modal property page frame.
The DbgWProc.Dll (Debug Object for AddressOf Subclassing) enables you to debug normally while a subclass is active without adding any unnecessary overhead to your finished product or distributing an extra component.
Subclassing is a technique that enables you to intercept Windows messages being sent to a form or control. By intercepting these messages, you can then write your own code to change or extend the behavior of the object. VB5 provides the AddressOf keyword, which can be used to reroute Windows messages to your own message processing procedure. Subclassing using the AddressOf is very efficient, but makes debugging a project difficult. If the window you are subclassing receives a message when you are in break mode, VB will crash.
CodeFlow is a sample code library. Its mission is to aid in situations where the flow of code is somewhat problematic or unusual. Some of the code is complex, using Win32 APIs. Other code is very simple. The uniting factor is that these code snippets, wrapped into well-behaved interfaces, can greatly simplify the task of writing code with a demanding flow of execution.
RegObj.dll - ActiveX Manipulation of the Registry
RegObj.dll is an ActiveX server that allows Visual Basic developers to programmatically control the Registry without having to resort to the Windows API. Included is a document which discusses the object model of RegObj.dll, and includes some Visual Basic code to illustrate using the objects in the server to perform common types of registry manipulation. Although the code in the article is constructed in Visual Basic, any other language capable of constructing ActiveX client applications, such as Java or C/C++ can use this ActiveX DLL.
Visual Basic Resource Editor (VB5)
Notepad is no longer the only editor for your resource files! You can use the Resource Editor, a Visual Basic 5.0 add-in.
Anything that you need to do to a resource file (short of editing bitmaps & cursors) can be done in the Resource Editor, operating entirely within the Visual Basic integrated development environment.
Visual Basic CoolBar Control
The Visual Basic Coolbar Control is a container control that allows you to create user-configurable toolbars similar to those found in Microsoft Internet Explorer 3.0. It consists of a collection of one or more resizable regions or bands. Each band can host a single child control.
This sample demonstrates an active-x control that displays its own name at design time and is invisible at run time.
Example of use: Why would a developer want to use this code? Suppose you've created a control which is invisible at run-time, such as a Timer or an ImageList. Such controls often simply display an icon at design time. If you have a large number of such controls on your form, it can be quite a bit of work to determine which one is which, to make sure that you've set properties on the correct control, etc. With this code, each control will clearly identify itself by name, preventing any such confusion.
One of the new UI elements in Windows is hot tracking. This means that objects may activate as soon as the mouse moves over them, then deactivate when the mouse moves off. Or, they may activate after the mouse has hovered over them for a little while. Or, they may activate at one level as soon as the mouse moves over them, then activate at a higher level after a pause, once again deactivating after the mouse moves off.
Take for example, the new-style toolbar buttons: As soon as you move over them, they activate, drawing a border around them. Then, after a pause, they activate at a higher level by showing a ToolTip. When the mouse moves off, they deactivate, erasing the border and the ToolTip. This sample code helps developers to implement this behavior.
The COOLBAR.VBP sample application contain tips and tricks on how to use the Coolbar control in COMCT332.OCX. COOLBAR.VBP is a sample VB5 project that demonstrates how to create an application with a user interface similar to Internet Explorer 3.x. The code is loaded with comments describing various tips, tricks, and techniques for using the coolbar with other controls.
ObjSafety.Dll and ucObjSafety.OCX both implement the IObjectSafety interface, which exposes functionality to Internet Explorer 3.x's Safe For Scripting and Safe For Initialization Security features. This sample contains code which will allow you to compile both items.
IObjectSafety should be implemented by objects that have interfaces which support "untrusted" clients (for example, scripts). It allows the owner of the object to specify which interfaces need to be protected from untrusted use. Examples of interfaces that might be protected in this way are:
- IID_IDispatch - "Safe for automating with untrusted automation client or script"
- IID_IPersist* - "Safe for initializing with untrusted data"
IID_IActiveScript - "Safe for running untrusted scripts"
* anything starting with IPersist
Two HTML samples have been included to demonstrate the use and testing of the ObjSafety.dll and ucObjSafety.OCX sample Visual Basic projects.
Visual Basic Application Wizard Update (VB5)
The Application Wizard lets you generate an application using one of the predefined visual interfaces - Multiple Document Interface (MDI), Single Document Interface (SDI), or Explorer Style.
The application you generate contains a toolbar and a status bar. The default toolbar for SDI and MDI forms is similar to a Microsoft Office toolbar. It includes the New, Open, Save, Print, Cut, Copy, Paste, Bold, Italic, Underline, Align Left, Align Right, and Center buttons.
Explorer-style applications have a default toolbar with the Navigation Buttons, Cut, Copy, Paste, Delete, Properties, View Large Icon, View Small Icon, View List, and View Details buttons. You can customize the toolbar. The status bar includes information about the status of the application and the date and time.
This Upgrade Contains:
- Completely customizable menus with persistence between sessions
- A Toolbar Builder which builds a Toolbar when you drop one on a form
- Integration with the Data Form Wizard to allow more user-specific database scenarios
Visual Basic Data Form Wizard Update (VB5)
The Data Form Wizard is designed to automatically generate Visual Basic forms that contain individual bound controls and procedures used to manage information derived from database tables and queries.
You can use the Data Form Wizard to create either single query forms to manage the data from a single table or simple query, or Master/Detail type forms used to manage more complex one-to-many data relationships. If you are using a control, you can also create a grid or datasheet type form.
The Data Form Wizard is used in conjunction with either the Data or the RemoteData controls, or DAO or RDO code.
This Upgrade Contains:
- Ability to build code-only forms where controls are not bound to a data control
- Use of DAO or RDO code depending on database type
- Integration with the App Wizard
Visual Basic Class Builder Utility Update (VB5)
The Class Builder utility helps you build your class and collection hierarchy for your Visual Basic project. The Class Builder utility keeps track of the hierarchy of your classes and collections and generates the framework code necessary to implement the classes and collections, including the properties, methods, events, and enums.
This Upgrade Contains:
- Addition of Enums
- Addition of ParamArray, Optional, ByVal, and Default values in argument list
- Bug fixes
- Enums appear only on the All tab.
Visual Basic Setup Wizard Update (VB5)
The Setup Wizard is a tool used with the Visual Basic Setup Toolkit that helps you create application setup and distribution media. You can also use the Setup Wizard to create dependency (.dep) files.
The Setup Wizard supports:
- Multiple floppy disks, and it can split files that are too large to fit onto a single floppy.
- Copying your files to a hard disk directory for distribution over a network or on CD-ROM.
- Distribution of your application across the Internet using automatic code download from Microsoft Internet Explorer, Version 3.0.
Note: The Setup Wizard is designed for Visual Basic developers and isn't a general Windows Setup Tool.
This Upgrade Contains:
- Bug fixes to the Setup Wizard that was released with VB 5.0