VB 6.0 - Checking for ADOBE Acrobat Reader... - Asked By Robbe Morris on 22-Aug-01 10:25 AM

...What is the best way to see if this object is installed on the users PC if I DON'T have it referenced in my project file.

Basically, I'm looking for the CreateObject construct for the Acrobat Reader if there is one.

Any ideas?

Error Trap - Asked By Desert Ghost on 22-Aug-01 12:12 PM

I'd imagine with checking for any optional program, I'd do something like:

On Error GoTo Handler:

Set o = CreateObject("dllname.class")

'if ya get here, you're successful

Handler:
   If err.description = "invalid class string" Then'or whatever it is

yourfunction = "You don't have acrobat... download it for free here"


Probably a more eloquouent way though, but this should work ...

Yeah, I use that for Excel - Asked By Robbe Morris on 22-Aug-01 12:13 PM

...Do you know the object and classname for Adobe Acrobat?

Searching my registry - Asked By Desert Ghost on 22-Aug-01 12:20 PM

Comes up with 

ArcoExch.Document

for version 4... don't know if this is right.   Seems to have a bunch of executables associated with it though.
Ok. I'll take a look at that! - Asked By Robbe Morris on 22-Aug-01 12:22 PM
Thanks.
This seems to work for all versions... - Asked By Robbe Morris on 24-Aug-01 01:18 PM
This code would of course go in a module file to support the API calls.



Const KEY_READ = &H20019
Const HKEY_LOCAL_MACHINE = &H80000002
  
Function CheckRegistryKey(ByVal hKey As Long, 
                          ByVal KeyName As String) 
                          As Boolean
    Dim handle As Long
If RegOpenKeyEx(hKey, KeyName, 0, KEY_READ, handle) = 0 Then
   CheckRegistryKey = True
   RegCloseKey handle
 End If
End Function

 Function CheckAdobe() As Boolean
    CheckAdobe = CheckRegistryKey(HKEY_LOCAL_MACHINE, "SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\APP PATHS\ACRORD32.EXE")
End Function