VB6: Trying to register ActiveX component (Adobe FDF Toolkit) and getting error 429
Posted on 2003-03-25
Greetings all, I am trying to register an ActiveX component in VB6, but can't seem to do it correctly. When I run the app (from within the VB IDE), I keep getting "Run Time Error 429, ActiveX component can't create object."
The component is Adobe's FDF Toolkit (FDFACX.DLL), and the application is a sample that came with it from planetpdf.com. To try to register it in VB, I go to the Project menu > References > Browse... to the DLL and open it, and then make sure it's box is checked in the References dialog for this project.
The project is a very simple program:
- 2 text fields (First name "txtName" & Surname "txtSurname")
- 1 Command button "Command1"
The purpose is to create an .fdf document that will populate a .pdf (already supplied for the sample) that has 2 fields in it ("name" and "surname" appropriately enough). when you click the command button, it uses the ShellExecute API method to launch the .fdf file (in its associated app, in this case Acrobat).
The error occurs when it tries to CreateObject("FdfApp.FdfApp"). I am new to VB (perl hacker mostly), so I know there is something really stupid that I'm missing. The source code is below (it's pretty short), so if anyone can point me in the right direction, I'd be very grateful.
'********** START CODE LISTING ***********************
' First off declare the API function
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_NORMAL = 1
Private Sub Command1_Click()
Dim FdfAcX As FDFACXLib.FdfApp
Dim objFdf As FDFACXLib.FdfDoc
' Perform validation
If txtName = "" Or txtSurname = "" Then
MsgBox "You must enter a name and surname"
Set FdfAcX = CreateObject("FdfApp.FdfApp") '<---- HERE IS WHERE IT BOMBS OUT
' Create a blank FDF file
Set objFdf = FdfAcX.FDFCreate
' Add the name
objFdf.FDFSetValue "name", txtName, False
' Add the surname
objFdf.FDFSetValue "surname", txtSurname, False
' Set the PDF to open
' Save the file
' Close the file
' Start Acrobat (via the FDF file)
ShellExecute vbNull, "open", "Customer.fdf", vbNull, vbNull, SW_NORMAL
Set objFdf = Nothing
Set FdfAcX = Nothing
'********** END CODE LISTING ***********************