Link to home
Start Free TrialLog in
Avatar of sahinman
sahinmanFlag for United States of America

asked on

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

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.
Avatar of samiran_cj
samiran_cj


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.









Avatar of sahinman

ASKER

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!
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).
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.
ASKER CERTIFIED SOLUTION
Avatar of samiran_cj
samiran_cj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for your 'Expert' information. My project works as planned.