?
Solved

I get the following error message: Cannot load control AcroPDF1. How do I fix the error?

Posted on 2005-03-29
6
Medium Priority
?
3,393 Views
Last Modified: 2012-05-05
I have a VB6 project with a form that has the AcroPDF.DLL (Acrobat Reader v7.0). My program works fine, it displays the desired PDF file without any errors. When I save the project it saves the reference to the DLL in the form [ I opened the form with notepad to view the text ], but when I close the project and open it again, I get the following error message :  Cannot load control AcroPDF1
When I open the form, sure enough, it's not there!

When I compile the EXE file, it works fine also. It is just very annoying to have to put the control back on the form every time I start working on the project. Any help would be greatly appreciated.
0
Comment
Question by:sahinman
[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
  • 3
  • 3
6 Comments
 
LVL 1

Expert Comment

by:samiran_cj
ID: 13659491

It looks like the dll is not registered correctly.  Before adding to the form try setting a reference to the DLL in the project list, i.e., go to Project->References then select the AcroPDF1 dll. If you cannot find it in the list then Windows has not registered the location of  DLL, which is probably  the cause of the errror message specifying failure to load DLL.
 If so then you will have to manually try to register the DLL location before adding it to your project reference list. after that you should have no problem in a form.









0
 

Author Comment

by:sahinman
ID: 13660231
I set the reference to the DLL in the project list before submitting my question, and after receiving your reply I removed the control and added it back again as per your suggestion, but the problem persists. My Windows XP was just installed less than a week ago so there should not be a problem with WinXP or VB6 install. The only line of code in the form is in the Form_Load: AcroPDF1.LoadFile "C:\Windows\Temp\Temp.pdf"

Still stuck!
0
 
LVL 1

Expert Comment

by:samiran_cj
ID: 13661589
Can you see the correct version number of the DLL in the both the main project file and form file when you open with notepad.
that is to say you should see a line like this which is a reference to your control.
 
OBJECT =   { registry GUID xxxxxxxxxxxxxxxxx } version #; path_to_dll \acropdf.dll

Does  the GUID match in the registry, and version number and path of your dll (check the DLL properties)

If any one of these is wrong VB will not find your control. Perhaps Vb6 got hold of the wrong dll info while saving.If so modify your project file and form file using notepad  to get a perfect match. (Take your backups).
0
Independent Software Vendors: 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!

 

Author Comment

by:sahinman
ID: 13688146
I copied the following information from my project file and form

Project file:
Object={05BFD3F1-6319-4F30-B752-C7A22889BCC4}#1.0#0; AcroPDF.dll

Form:
Object = "{05BFD3F1-6319-4F30-B752-C7A22889BCC4}#1.0#0"; "AcroPDF.dll"

Looks like they match except for (3) spaces and (4) quote ["] marks.

I looked in the registry but am confused as to the 3rd part of you message:
Does  the GUID match in the registry, and version number and path of your dll (check the DLL properties)

Would you please explain this further.
0
 
LVL 1

Accepted Solution

by:
samiran_cj earned 2000 total points
ID: 13693732
So it was not a GUID problem, and version and path is OK.
As final conclusion I suspect that the type library OCA,  VB generated is faulty.  
This is not easy for me to solve. So my best suggestion is project workaround like suggest below.

Load control dynamically at run time after project opens,    I have pasted code below to show .

Interesting to note how  VB tells you now ProgID changed and correct ProgID too.
 ( Now why VB cannot find at project start up time and solve our trouble in first place ? )
But I  still cannot access new ProgID from design IDE. All properties can be set from code anyhow.

you will have to remove warning about unused dynamic ActiveX control by setting Project  Options as described.  (one time removal only)

good luck with code below
______________________________________-

Dim AcroPDDoc As AcroPDFLibCtl.AcroPDF

Private Sub Form_Load()

  Set AcroPDDoc = Controls.Add("AcroPDF.PDF.1", "AcroPDDoc")  'ProgID used to be  AcroPDFLibCtl.AcroPDF
    AcroPDDoc.Left = 10
    AcroPDDoc.Top = 10
    AcroPDDoc.Height = Form1.Height
    AcroPDDoc.Width = Form1.Width
    AcroPDDoc.LoadFile "temp.pdf"   ' Use your PDF doc here
    AcroPDDoc.Visible = True
   
End Sub
0
 

Author Comment

by:sahinman
ID: 13695772
Thank you for your 'Expert' information. My project works as planned.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

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