|
The most common problem people get with code on this site is VB's super friendly
error 429, "ActiveX Can't Create Object". This might happen to you when you're running
in the VB IDE, or when you're trying to distribute a EXE using vbAccelerator controls to a
new machine.
Don't Panic!
Despite the mysterious appearance of this error message, you should find it pretty easy to
solve. The error message itself can occur for one of four reasons (listed in order of
likeliness):
- You do not have a required TLB or ActiveX DLL/OCX file.
- A TLB or ActiveX DLL/OCX needed by the project is present but not registered on your system.
- The VB runtimes are an earlier version than the one you need to run the project.
- A required TLB or ActiveX DLL/OCX file is corrupt.
To solve the error is a process of elimination. The first and most important step is to
make sure you know what the dependencies are for the project.
Know Your Dependencies
This site lists all the
dependencies for a project at the top of the sample in the section
Before You Begin. Currently, this information is not
always included in the zips so I strongly recommend that you save a copy of the HTML
page from which you download a project from as well as downloading the project.
Here is a sample dependency list:
  |
Before you Begin
|
  |
  |
|
These projects require the SSubTmr.DLL component. Make sure you have loaded and registered this before trying any project.
|
  |
This tells you which components you must have and any registration requirements for them;
in this case you must have SSubTmr.DLL on your system and it must have been registered.
If you try to run the executable with the project before you have done this, the executable
will fail at start up with Error 429. If you try to run the project code in VB, it will fail
as soon as you try to create the object. With control projects, this is whenever you show
the form (whether at run-time or design-time), and with DLL projects this is whenever the first
method is called on the DLL.
|
Tip Download and Register SSubTmr.DLL first
|
|
|
Almost all of the samples on this site need SSubTmr.DLL. This DLL is the library
I use to get consistent and reliable subclassing to work in VB. Although VB5 and 6 allow
you to write subclassing code directly into your project, it is difficult, error-prone and
makes your code very difficult to debug. I isolated the code into this DLL to make things
more managable.
If you download and register this file on your system before trying anything else, you'll
almost certainly have an easier time! Don't forget either to include this file and mark it for
registration in any setup kit you write if you include vbAccelerator controls.
|
|
Registering ActiveX DLLs and OCXs
There are various ways of registering a TLB or ActiveX DLL/OCX on your system, all of which
ultimately do the same thing, which is to call the DLLRegisterServer method exposed by
all in-process ActiveX components.
The methods are:
- Use VB as a registration tool.
- Run Regsvr32.exe.
- Call DLLRegisterServer from your own code.
|
1. Using VB as a registration tool.
|
|
|
|
The dialog boxes you get when you choose Project-Components (Ctrl-T)
for controls and Project-References for DLLs both
allow you to register components automatically. Choose the appropriate
box, click Browse... and locate the OCX, DLL or TLB. Click OK. The
component will be registered. Note that you should do this before you
try to load a project which requires one of these components.
Note: I have discovered that VB fails to register TLBs correctly through the Project-References
dialog. Use the vbAccelerator TLB Registration Utility
instead if you use Type Libraries frequently.
|
|
|
2. Run Regsvr32.exe
|
|
|
|
Regsvr32.exe is a small executable provided with Win95 and NT systems which
calls DLLRegisterServer on a specified file. To use it, just click Start-Run,
type regsvr32 and then drag the file you want to register from Explorer
onto the Start-Run box.
Click OK to do the registration. If it succeeds, there will be a message box
saying registration succeeded, otherwise the message box will tell you it failed
with some uninterpretable COM error code. If it fails, you have a bad VB runtime
or a corrupt file, or you have got the file name wrong.
Regsvr32 has a number of command line options which let you control what it does.
By default it registers a control or DLL and gives a message box saying what it
has done. The following command options let you modify this behaviour:
-
/u - Unregister server.
-
/s - Silent; display no message boxes
-
/c - Console output
You can use these options when writing simple install scripts in batch files.
|
|
|
3. Call DLLRegisterServer in code
|
|
|
|
The code for the VB Setup Wizard shows you how to call DLLRegisterServer yourself,
albeit using the DLL supplied with the SetupKit (VB5STKIT.DLL for VB5). Search for
DLLSelfRegister in the code to see how its done.
|
|
Registering ActiveX EXEs
You can register ActiveX EXEs on your system either using VB as registration tool (as described
above) or by using the little documented command line switch /REGSERVER
(not case-sensitive) when you run the executable.
Registering Type Libraries (TLB)
You can register TLBs either by using VB as a registration tool (as described above)
or by using the VB TLB registration utility, which comes with
complete source code.
If You Can't Register a File
First thing is to check the VB5 run-time files to see if you have
the right version. If this reveals the VB runtime version is ok, then you may have a corrupt
copy the file itself. Download a fresh copy and try it again. If you still don't have any
success, then there is something seriously wrong, and perhaps its time to perform that rebuild
you had been looking forward to for so long :)
Conclusion
By following these steps you should have no problem getting any code to run off this site.
Hope it helps!
Back to top Back to Installation Back to Home
|
  |