VB4HT: CD-ROM ReadMe
 




September 19, 1995
Special Late-Breaking News
Three Custom 32-bit OCX and 16-bit VBX controls are contained on the CD-ROM.
  • Message Hook
  • FireEvent
  • HiTimer
Message Hook is the VB4 32-bit OCX version of the VB3 16-bit VBX MsgHook control that was distributed with Waite Group's Visual Basic How To, 2nd Edition, a best-selling book that covers Windows 3.1 and VB3. The MsgHook control allows you to intercept messages that VB would otherwise ignore or not notify you of via an event. With this power, you can dip into the Windows API and do amazing things from Visual Basic. Both 16- and 32-bit versions are in the SYSTEM folder on the CD-ROM.

FireEvent is a 32-bit control that lets you add the ability to fire events from a class form, something Microsoft left out of this version of Visual Basic for some reason. You can see examples of using Firevent in How-To 1.6, Build Your Own Sprite, and in Chapter 5, which covers high-speed graphics. Both 16- and 32-bit versions are in the SYSTEM folder on the CD-ROM.

HiTimer is a 32-bit control that lets you create a timer that has a true 1 millisecond resolution. It's used in the Drum Machine project in Chapter 4, where it provides a timer that is fast enough to accurately control high-speed drum beats. Both 16- and 32-bit versions are in the SYSTEM folder on the CD-ROM.

WARNING: Because of some library DLL synchronization problems between the version of VC++ used to build VB4 and the version we used to build our controls, you need to be sure that the OC30.DLL we used to build our controls is placed in your WINDOWS/SYSTEM folder. If the OC30.DLL file is missing your controls won't register and the projects that use them will not run properly.
Using Other 3rd Party Controls
If you install a control that installs its own OC30.DLL in the SYSTEM folder you need to be careful. Checking dates of the DLLs is not adequate. What you need to do is check the version of the DLLs. To find the version, right-click on the DLL itself and select properties from the pop-up menu. Then select the Version tab and you can read the version number of the DLL. If the version of the new OC30.DLL you are installing is lower then the version of the OC30.DLL we used, DON'T copy it over, as our OC30.DLL should work for your new control.
How-To 5.9 Space Game
To get optimal performance, How-To 5.9, Game, should be run in the 256-color mode. Set this by right-clicking on the display background (not a window) and select Properties. Up pops the Display properties. Click on the Settings Tab and make sure your Colors says "256 Colors." Our testing resolution was 800x600.

When you want to stop this project from running, be sure to use the File->Exit menu to do so. If you simply press VB4's stop button you will discover the next time you run VB4 that the Wavemix DLL has been corrupted and you will have to restart VB4 to clear it.
Note on Projects using WING and WAVEMIX
If you are using only the 32-bit version of the projects that use Wavemix and WinG, then you need only install the 32-bit versions of the DLLs for Wavemix and WinG. If you plan to run the 16-bit version of these projects, you need to install the 16-bit versions of these DLLs. If you run the WinG setup program included on this disk, WinG will set up all the required 16-bit files for you to run our projects.
  • 32-bit projects require: WING32.DLL, WINGEX32.DLL, and WAVEMIX.DLL
  • 16-bit projects require: WAVEMIX.DLL, WINGHELP.DLL, and everything that the WinG setup program installs on 16-bit systems.
32-Bit Only Projects
The following How-To's include only 32-bit code:
2-6 3-10 7-1 7-2 7-3
7-4 7-6 7-8 7-10 9-3
Now a Word About Our Wonderful and Super Useful CD-ROM
The Visual Basic 4 How-To CD-ROM is packed with all the files you'll need to run the 80 original projects in this book. Most of the projects will run in either the 16-bit or the 32-bit version of Visual Basic 4.0 by using conditional compilation. In some cases, instead of conditional compilation we provided both 16- and 32-bit versions of the projects. In those cases, inside each 32-bit How-To folder will be a folder called 16-bit, which holds the 16-bit version of that How-To. Note that a handful of projects are written to run only in the 32-bit version of Visual Basic.

Projects on the CD-ROM are organized by Chapter and How-To. There's a folder for each Chapter. And, within each Chapter, a folder for each How-To. Figure 1 shows a Windows 95 Explorer window view of Chapter 5 How-To 5-8. In the How-To folder you'll find the Visual Basic Project file (.VBP) and all the Forms, Classes, and General modules needed to run the project. If the project also uses a custom control or dynamic link library unique to this book, it will be available in the SYSTEM folder as explained below.
readme1.gif (21601 bytes)

Figure 1: This CD contains nearly 17MB of How-To project files. The basic folder layout is depicted above. Each How-To is stored in its own folder.
Reusing Our Classes is Free--and It's Easy!
The CD is also loaded with reusable class files, 45 to be exact! As you work through the projects in this book, you can expect to find a few class modules (or more than a few) that you'll want to drop into your own projects and reuse. And we expect you'll feel the same way about reusing the general modules, custom controls, and dynamic link libraries (DLLs).

We hope we've made that easy by organizing them into an additional set of folders. With this in mind, we've gathered up all the class modules, general modules, custom controls, and dynamic link libraries into their own folders.
  • The class modules (.CLS) are all together in a folder called CLASSES
  • The general code modules (.BAS) are in a folder called MODULES
  • The custom controls (.OCX) and (.DLL) are in a folder called SYSTEM
(Please carefully read the special instructions below for installing the OCXs.)
Ready to Load and Run in Visual Basic 4.0
Most of the projects are ready to run direct from the CD-ROM, without any preparation on your part. You can just start Visual Basic, open a Project file (.VBP) from the CD-ROM, and run it. But be aware that if you load and run a project from the CD-ROM without copying it to your hard drive, you won't be able to save changes.

Some How- To's may attempt to write to the project folder in order to demonstrate a concept. These projects, when run from the CD-ROM, will result in a run-time error. So to run them, you'll need to copy these projects to your hard drive.
Copying Projects to Your Hard Disk
If you've got the disk space for it (about 17MB), we think the best way to use the CD-ROM is to just copy everything to your hard drive. Using the Windows 95 Explorer or your Windows File Manager, you can easily drag the entire VB4HOWTO folder from the CD-ROM to your hard drive. Or if you want to conserve on disk space, drag a How-To folder to your hard drive when you're ready for it, as you work through the How-To in the book.
Removing Read-Only Properties Using Windows 95
Note that the files on the CD-ROM are all marked Read-Only. When you copy them to your CD-ROM, you'll want to remove the Read-Only attribute so you can change them as needed. If you're using the Windows 95 Explorer, it's easy. Simply highlight all the files by either dragging or shift-clicking, click the right mouse button to view their properties, and uncheck the Read-Only property. Windows will change the setting for all the files you have selected.
Removing Read-Only Properties Using DOS
If you prefer doing file operations at the DOS command prompt, a simple way to copy them is to open a DOS box and XCOPY the entire VB4HOWTO directory to a suitable location.
Steps
  1. First, ensure adequate available drive space, then from a DOS prompt enter the following XCOPY command, substituting the appropriate drive letters:

                D:\>XCOPY D:\VB4HOWTO\*.* C:\VB4HOWTO /S
                Does VB4HOWTO specify a file name
                or directory name on the target
                (F = file, D = directory)?d
    
  2. After you copy the files, make sure that each file's Read-Only attribute is turned off. At the DOS prompt, enter the following ATTRIB command, substituting appropriate drive letters:

                D:\>ATTRIB -R C:\VB4HOWTO\*.* /S
    
If you choose not to copy all the project files, you still must make sure to copy the custom controls and DLLs to your system directory. When OCXs are registered, their path is stored in a companion OCA file created in the system directory. If the OCXs were left on the CD-ROM, you would run into registration troubles later on if the VB4 How-To CD-ROM was not present in the CD-ROM drive. Additionally, the DLLs would not be on your system's search path, and runtime errors would be triggered.
System File Installation
Before you run a project that uses a custom control or dynamic link library, you'll need to copy it to your Window's System folder. Of course you only need to do this once, before you use it for the first time.
Copy Controls to Your System Directory
We recommend that you copy all the custom controls and DLLs on the CD-ROM at once, using the Window 95 Explorer or the Windows File Manager. First highlight the files in the SYSTEM folder on the CD-ROM. Then drag them all to your Windows System folder.

Where exactly you need to place them will depend on which Windows operating system(s) you're using.
  • If you're running Windows 3.x only, drag the 16-bit files to your WINDOWS\SYSTEM directory.
  • If you're using either Windows NT or Windows 95, drag all the files in the SYSTEM folder on the CD-ROM to the System folder located in your Windows folder.
  • If you're dual booting NT and Windows 3.x, drag the 16-bit files to your WINDOWS\SYSTEM directory, and the 32-bit files to your WINDOWS\SYSTEM32 directory.
  • If you're dual booting Windows 95 and Windows 3.x, drag the 16-bit files to your Windows 3.x WINDOWS\SYSTEM directory, and drag all of the CD-ROM SYSTEM files to the System folder located in your Windows folder.
  • If you are single booting Windows 95, and drag all of the CD-ROM SYSTEM files to the System folder located in your Windows folder.
Table 1 shows which system files are 16-bit and which are 32-bit.
16-Bit System Files 32-Bit System Files
FIREVE16.OCX
HITIME1.VBX
HITIME.LIC
MSGHOO16.OCX
WAVEMIX.DLL
WINGHELP.DLL
FIREVE32.OCX
HITIME32.OCX
MSGHOO32.OCX
WAVMIX32.DLL
WINGEX32.DLL
WING32.DLL
OC30.DLL ***

Table 1: 32- and 16-bit files in the CD-ROM SYSTEM Folder
Registering the Custom Controls
After you copy the System files to your hard drive, you'll need to register the custom controls. The easiest way to do this is to open Visual Basic and choose Custom Controls from the Tools menu. From this dialog, press the Browse button, highlight each of the OCX files in turn, and press OK. The selected OCX will register itself with your system. When you finish, you should see them listed with your other Custom Controls. You may now check and uncheck the references (as listed in Table 2) to include and exclude them from your projects. Of course, only the 32-bit OCXs will load into the 32-bit version of Visual Basic, and only the 16-bit OCXs and VBXs will load into the 16-bit version of Visual Basic.
Custom Control Descriptions
Event Sink OLE Custom Control module
Hitime OLE Custom Control module
Msghook OLE Custom Control module

Table 2: Control names as they appear in VB4's Custom Control dialog

Important Note on 32-Bit Controls!
The OC30.DLL is required to use the 32-bit OLE custom controls included with Visual Basic 4.0 How- To. This file is part of the VC++ MFC library that was originally used to build the control in VC++ 2.2. The controls that Visual Basic 4.0 are based on are Visual C++ 4.0. The DLL for Visual C++ 4.0 is provided in Windows 95, but since we did not have that library, our DLL is required for our controls to register properly. As VC++ versions change and the library files grow, all control vendors must ship the DLL they used along with their controls. That is the way it works.

This also means that you will need to include OC30.DLL within your distribution set. Unfortunately, the Visual Basic 4.0 Setup Wizard does not detect the dependency of our OCXs on this DLL. If you are using the Setup Wizard, you must manually add OC30.DLL at Step 7 in the process.
Warning About Copying OC30.DLL
OC30.DLL is located in the SYSTEM directory of the CD-ROM, with the other DLLs and OCXs. But, before you copy it to the SYSTEM folder on your hard disk, you should ensure that you don't already have this DLL, or if you do that the one you have on your hard disk is not a more recent version. In other words, if our DLL is newer version then the one on your hard disk, you may copy ours over. But if the one on your hard disk is newer then the one on our CD-ROM, don't copy ours over it; the one on the hard disk should work for our controls.

We've included version 3.10 of OC30.DLL on this CD-ROM. To determine what version you have on your hard disk, right-click on it in Explorer, select Properties, and view the Version tab of that dialog. Or, highlight it and select File-Properties in File Manager.
Distribution Information
If you wish to find out about distribution of these 32-bit controls when using VC++ 4.0, you can contact Waite Group Press technical support at:
Phone: (415) 924-8102
FAX: (415) 924-2576
Email: vb4support@waite.com
drdrax1@waite.com
Post: 200 Tamal Plaza, Suite 101
Corte Madera, CA 94925
Technical Support
If you encounter problems with the CD-ROM, technical assistance can be obtained from Waite Group Press through these channels:
Phone: (415) 924-8102
FAX: (415) 924-2576
Email: drdrax1@waite.com
WWW: http://www.waite.com/waite
Post: 200 Tamal Plaza, Suite 101
Corte Madera, CA 94925
Code Changes and Updates
In a few instances, slight code changes occurred after the book had gone to print. In these cases, there will be a README.TXT file in the directory containing that project that describes the changes. If updates or bug fixes become available for either the code or the custom controls presented in this book, they will be posted with a new README in a folder named VB4HT on Waite Group Press' World Wide Web Site. You may access this site via:

http://www.waite.com/waite
ftp://ftp.waite.com

While there, please feel free to leave feedback for the authors of this book and to peruse the other Visual Basic 4 offerings from Waite Group Press!

wgplogo.gif (2416 bytes)

Main · Authors · Foreward · Contents · Introduction · Index · ReadMe · Errata