?
Solved

VB6: Trying to register ActiveX component (Adobe FDF Toolkit) and getting error 429

Posted on 2003-03-25
11
Medium Priority
?
3,519 Views
Last Modified: 2013-12-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"
        Exit Sub
    End If
   
    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
    objFdf.FDFSetFile "Customer.pdf"
    ' Save the file
    objFdf.FDFSaveToFile "Customer.fdf"
   
    ' Close the file
    objFdf.FDFClose
   
    ' Start Acrobat (via the FDF file)
    ShellExecute vbNull, "open", "Customer.fdf", vbNull, vbNull, SW_NORMAL
   
    ' Cleanup
    Set objFdf = Nothing
    Set FdfAcX = Nothing
   
End Sub
'********** END CODE LISTING ***********************


0
Comment
Question by:iceburglar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 

Author Comment

by:iceburglar
ID: 8207792
By the way, one more wrinkle: I am using Windows 2000, but I double-checked and I am in the Administrators group for this machine.

I am assuming that the installer for the application that I want to play with PDF/FDF's in (not the sample one here, I'm just trying to evaluate the component), the end-user will need to be in the Administrators group to install this (except for Win95/98/Me).
0
 
LVL 8

Expert Comment

by:List244
ID: 8207875
Are you sure the dll is meant for vb? Many dlls such as the api seen in the apiviewer are not meant for vb like that, in that case you must reference to it different such as:

Private Declare Function FUNCTIONNAME Lib "DLLNAME" (ByVal strFile As String) As String

Though you must know what it wants the function name dll name and such to use it
0
 

Author Comment

by:iceburglar
ID: 8208027
It is meant for VB, but I think it was expected to be used server side (ASP), but it does include some sample code for using it in a stand-alone client app (I believe). The overview is available here:
http://www.planetpdf.com/codecuts/pdfs/fdftkovr.pdf

The docs provide info for using several versions of the toolkit: C/C++, Java, Perl, and ActiveX, so it is pretty big (490 KB)

On page 46 of that manual, it says the following:

--------------------------------------
Using the FDF Toolkit in Visual Basic

FdfAcX.dll exposes one main object: "FdfApp.FdfApp". From Visual Basic v5.0, you might use the object like this:

   Dim FdfAcX As FDFACXLib.FdfApp
   Set FdfAcX = CreateObject("FdfApp.FdfApp")

You can now make other call to the FDF Toolkit library to parse or generate FDF data.
---------------------------------------

It then moves right into the section, "Using the FDF Toolkit with Active Server Pages"

One thing I did notice is that it says VB5 and I'm using VB6, but I am under the impression that higher releases of VB are pretty good about backward compatibility (for the most part, and of course .NET not withstanding).

Thanks for the reply, by the way.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:List244
ID: 8208066
Yeah it should work the same from vb6 to 5, sorry not sure on the problem, though maybe tomorrow if nobody has answered i can look into the pdf file and see.
0
 

Author Comment

by:iceburglar
ID: 8208175
Thanks for the effort List244. Just a note on the manual, that section that I posted is the complete section on VB, although there are a few pages dedicated to ASP's. So if you are on dialup, don't waste your time downloading it.

I think the problem lies in how I am registering the DLL, because I have tried using the command-line method:

C:\WINNT\system32> RegSvr32 FdfAcx.dll

And that throws up a dialog: LoadLibrary("FdfAcx.dll") failed - The specified module could not be found.
0
 
LVL 1

Expert Comment

by:hmadhur
ID: 8208689
Hi IceBurglar,
I think that the FDFACX.DLL might be corrupted or it is not downloaded properly. Try downloading it once again.

Before downloading it try changing the statement as below:
You have written:
Set FdfAcX = CreateObject("FdfApp.FdfApp")   '<---- HERE IS WHERE IT BOMBS OUT

change it to :
Set FdfAcX = CreateObject("FDFACXLib.FdfApp.FdfApp")   '<---- HERE IS WHERE IT BOMBS OUT

When you download the dll try executing the program. If it still gives the problem then change the statement and try again.

Hope this helps
Madhur
0
 
LVL 1

Expert Comment

by:hmadhur
ID: 8208696
Hi
I am sorry I added .FdfApp in the statement. Change it to
Set FdfAcX = CreateObject("FDFACXLib.FdfApp").

Sorry about that.

Regards
Madhur
0
 
LVL 1

Accepted Solution

by:
hmadhur earned 500 total points
ID: 8208869
Hi IceBurglar,
Ignore all my previous answers. The only thing you have to do is to copy fdftk.dll in Winnt directory. I downloaded the tool kit. And tried the vb sample. The same thing happened. Then I read in the Toolkit overview that FDFACX.DLL and FDFTK.DLL should be in the same directory. So copy the FDFTK.DLL in system32 directory and register FDFACX.DLL again using regsvr32. This time you will not get the error message (LoadLibrary("FdfAcx.dll") failed - The specified module could not be found). You will get a succeeded message.

My VB app works perfectly and the pdf file also shows the first name and last name I keyed in. The same sample you are refering to(First Name and Last Name). You will find this FDFTK.DLL in <unzipped contents folder>\Lib\C\Win.

Warm Regards
Madhur
0
 

Author Comment

by:iceburglar
ID: 8209087
Thanks, hmadhur, it did register when I moved the FDFTK.DLL file over.

Do you have the full Acrobat installed on your system or just the free Reader? (This will eventually end up in a commercial app, so I can't expect users to shell out for the full Acrobat version.)

If you happen to be familiar with PDF issues, I have some other concerns about this toolkit, specifically Adobe licensing. Would I be forced to pay run-time royalties for this thing? (You've already got the points for this, so if you're not sure, don't worry about it, just figured I'd ask in case you've used their SDK before.)

Thanks again!
0
 
LVL 1

Expert Comment

by:hmadhur
ID: 8209242
Sorry Friend,
I am a VB Freak. I dont know anything about Adobe Acrobat. I just use Acrobat Reader to read PDF files. I dont have the full version.

But, as the toolkit is freely available, I dont think you would need to pay runtime royalties. Just check with Adobe toolkit overview. It might be mentioned in there. If you dont have it, just shoot a mail at hmadhur@rediffmail.com
I will send it across. I dont have the time to go through the full licensing agreement.

I think I should have a peek at this Acrobat FDF thing. It sure feels interesting. huh?

Thanks for the full points.

Regards
Madhur
0
 

Author Comment

by:iceburglar
ID: 8220299
Thanks, hmadhur, it is working great (now to see if I can get our build machine to make it work, or more specifically get the installer to register it properly).

I have all the Adobe licensing stuff, it's just that all the legalese scares me. If I am reading it correctly, my usage shouldn't be a problem at all.

I'm not sure what kind of dev work you do, but you probably come into contact with PDF files somewhere. The toolkit is definitely pretty cool, although it does have some limitations, namely the file you create is an FDF file. Acrobat Reader is normally associated with these, so double-clicking it will launch the .fdf, which has the name of the .pdf so the reader will merge the two. I also don't see any way to "lock" the fields, so user's can potentially overwrite the items I populate for them on the form.

I mostly do perl stuff for the web (I inherited a VB client project), and they do have a perl version which I will be most definitely be playing with at some point.

Thanks again for the help, as easy as it may have seemed for you, it was giving me fits because I knew I was so damn close to getting it.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question