Results 1 to 29 of 29

Thread: Check if full Acrobat is installed and not only Acrobat reader?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665

    Question Check if full Acrobat is installed and not only Acrobat reader?

    How can I check if the user have full acrobat installed and not only Acrobat Reader?

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    I have only the reader, and it would seem to me that this registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader

    should exist on computers with the reader installed. You should probably use the key that the full version uses, though, just in case they are both installed.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    I have the full package. You could see if under the UNINSTALL folder in the registry if DISTILLER is installed...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Thanks,

    But how can I check in the registry if the key exist?

  5. #5
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Search for Registry or similar. You'll find thousands of posts on it
    Last edited by jemidiah; Oct 21st, 2003 at 07:49 PM.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Yepp, I found many of them, but not any code there I could check
    if the registry key exist.
    Something like this:

    If HKEY_CURRENT_USER, "SOFTWARE\Adobe\Acrobat Distiller\"= True Then ...

  7. #7
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Just found this code: {I tweaked it a hair}

    VB Code:
    1. Const MAX_FILENAME_LEN = 260
    2. Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
    3. Private Sub Form_Load()
    4.  'KPD-Team 1999
    5.  'URL: [url]http://www.allapi.net/[/url]
    6.  'E-Mail: [email][email protected][/email]
    7.  'Tweaked by Lou
    8.  
    9.     Dim i As Integer
    10.     Dim s2 As String
    11.     Dim MyFile As String
    12.    
    13.     MyFile = App.Path & "asdftemp.pdf"
    14.     Dim MyF As Integer
    15.     MyF = FreeFile
    16.     Open MyFile For Output As #MyF
    17.     Close MyF
    18.      
    19.     'Check if the file exists
    20.     If Dir(MyFile) = "" Or MyFile = "" Then
    21.          MsgBox "File not found!", vbCritical
    22.          Exit Sub
    23.     End If
    24.     'Create a buffer
    25.     s2 = String(MAX_FILENAME_LEN, 32)
    26.     'Retrieve the name and handle of the executable, associated with this file
    27.     i = FindExecutable(MyFile, vbNullString, s2)
    28.     If i > 32 Then
    29.        MsgBox Left$(s2, InStr(s2, Chr$(0)) - 1)
    30.     Else
    31.        MsgBox "No association found !"
    32.     End If
    33. End Sub

    It returns:

    C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
    Now, looking up reader on my machine, its exe is:
    "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe"
    Therefore, if the string ends with Acrobat.exe, then its not the reader.

    Of course, if ".pdf" is not registered to either Acrobat or Reader, then the return won't be either.


    -Lou

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    That will not work for determining if the workstation has Acrobat
    Approval installed. Approval is a limited version of the full version
    Acrobat. They both use the same name for their executables.
    So, with this method you cannot determine if the user has
    Acrobat Approval or Acrobat full version.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Do you know whether the registry key is the same for Approval as it is for either of the other two versions?
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  10. #10
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Originally posted by RobDog888
    That will not work for determining if the workstation has Acrobat
    Approval installed. Approval is a limited version of the full version
    Acrobat. They both use the same name for their executables.
    So, with this method you cannot determine if the user has
    Acrobat Approval or Acrobat full version.
    True. However, besidesn the 30 days, whats the diff between Approval and regular Acrobat?

    -Lou

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    The difference between Approval and Reader is that you can save
    forms in pdf format. The difference between Approval and Full
    Acrobat is Approval does not have the JavaScript console and
    some other features. I can't do it justice so look here.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    And how can I check if the user have Full Acrobat installed?

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You will probably have to check the registry still. That code
    posted above can not distinguish between Full and Approval
    since the default install path is the same.
    "Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe" for either one.

    Let me check the registry and see if there is a difference.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Ok, RobDog888!
    I guess you can solve this for me...

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    It looks like the only way is to enumerate the registry sub keys
    under the Adobe key - [HKEY_LOCAL_MACHINE\SOFTWARE\Adobe

    If Distiller found then = full version and if Approval also found
    then Approval was overwritten by full version.
    If Approval is found and no Distiller found then only Approval.
    If Reader is found then Reader version in addition to either case above.

    Also, there is another version that Adobe calls "Business Tools".
    I don't know what it is but may need to allow for this fourth case.

    HTH.
    Last edited by RobDog888; Oct 23rd, 2003 at 01:28 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Ok Thanks again!

    How does the code, to enumerate the registry sub keys
    under the Adobe key - [HKEY_LOCAL_MACHINE\SOFTWARE\Adobe if destiller exist, look like?

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Here is a sample on enumerating the registry keys.
    VB Code:
    1. Const ERROR_NO_MORE_ITEMS = 259&
    2. Const HKEY_CURRENT_CONFIG = &H80000005
    3. Const HKEY_LOCAL_MACHINE = &H80000002
    4. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    5. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    6. Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
    7. Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    8. Private Sub Form_Load()
    9.     'KPD-Team 2001
    10.     'URL: [url]http://www.allapi.net/[/url]
    11.     'E-Mail: [email][email protected][/email]
    12.     Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
    13.     Const BUFFER_SIZE As Long = 255
    14.     'Set the forms graphics mode to persistent
    15.     Me.AutoRedraw = True
    16.     Me.Print "RegEnumKeyEx"
    17.     Ret = BUFFER_SIZE
    18.     'Open the registry key
    19.     If RegOpenKey(HKEY_LOCAL_MACHINE, "Hardware", hKey) = 0 Then
    20.         'Create a buffer
    21.         sName = Space(BUFFER_SIZE)
    22.         'Enumerate the keys
    23.         While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0& <> ERROR_NO_MORE_ITEMS
    24.             'Show the enumerated key
    25.             Me.Print "  " + Left$(sName, Ret)
    26.             'prepare for the next key
    27.             Cnt = Cnt + 1
    28.             sName = Space(BUFFER_SIZE)
    29.             Ret = BUFFER_SIZE
    30.         Wend
    31.         'close the registry key
    32.         RegCloseKey hKey
    33.     Else
    34.         Me.Print "  Error while calling RegOpenKey"
    35.     End If
    36.     Me.Print vbCrLf + "RegEnumValue"
    37.     Cnt = 0
    38.     'Open a registry key
    39.     If RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", hKey) = 0 Then
    40.         'initialize
    41.         sName = Space(BUFFER_SIZE)
    42.         sData = Space(BUFFER_SIZE)
    43.         Ret = BUFFER_SIZE
    44.         RetData = BUFFER_SIZE
    45.         'enumerate the values
    46.         While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS
    47.             'show data
    48.             If RetData > 0 Then Me.Print "  " + Left$(sName, Ret) + "=" + Left$(sData, RetData - 1)
    49.             'prepare for next value
    50.             Cnt = Cnt + 1
    51.             sName = Space(BUFFER_SIZE)
    52.             sData = Space(BUFFER_SIZE)
    53.             Ret = BUFFER_SIZE
    54.             RetData = BUFFER_SIZE
    55.         Wend
    56.         'Close the registry key
    57.         RegCloseKey hKey
    58.     Else
    59.         Me.Print "  Error while calling RegOpenKey"
    60.     End If
    61. End Sub
    Just modify it to enumerate the hive you need.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Originally posted by RobDog888
    If Distiller found then = full version and if Approval also found
    then Approval was overwritten by full version.
    If Approval is found and no Distiller found then only Approval.
    If Reader is found then Reader version in addition to either case above.
    Are you sure Approval is a seperate from Full Acrobat?
    It seems to be only a patch, and if so, does it matter if you have approval patched into Acrobat?

    It surely doesn't destroy the existing functionality of the parent program, does it?

    I mean, Acrobat.exe is still the full Acrobat, wether it has this patch or not?

    If its not a patch, then why does the install screens title say "Patch".

    -Just wondering
    -Lou

    Attached Images Attached Images  

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Because what you have IS the patch for Approval. It patches Approval version 5.0.5.

    Attached is the splash screen for Approval 5 that I have installed
    on my laptop.
    Attached Images Attached Images  
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    If you had the Full Acrobat at:

    C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe

    Where does approvals exe install itself?

    If its the same install path, then what happens to Your full Acrobat?

    -Lou

    BTW, the Screenshot came from partially running the download from:

    http://www.versiontracker.com/php/dl...x/A505AFP1.exe

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Approval has a check in it to determine if Full Acrobat is installed
    or not. If it is then Approval aborts the installation, since Adobe
    thinks that you would not want to downgrade your Acrobat.

    They both install to the same path and exe name.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  22. #22

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob. Glad to help.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    RobDog888,

    I tried your sample on enumerating the registry keys but I can't understand how I can do a function as Boolean of it.
    If it's true, then full acrobat is installed. Can you show me that?

  25. #25
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ya, but I don't have time until tonight.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  26. #26

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Ok, I'll wait...

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    RobDog888...where are you...

  28. #28
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Here I am. I had a busy weekend.
    VB Code:
    1. 'Put this code into a module.
    2. Option Explicit
    3.  
    4. Public Const HKEY_CLASSES_ROOT = &H80000000
    5. Public Const HKEY_CURRENT_USER = &H80000001
    6. Public Const HKEY_LOCAL_MACHINE = &H80000002
    7. Public Const HKEY_USERS = &H80000003
    8. Public Const HKEY_PERFORMANCE_DATA = &H80000004
    9. Public Const HKEY_CURRENT_CONFIG = &H80000005
    10. Public Const HKEY_DYN_DATA = &H80000006
    11. Public Const REG_SZ = 1                         ' Unicode nul terminated string
    12. Public Const REG_BINARY = 3                     ' Free form binary
    13. Public Const REG_DWORD = 4                      ' 32-bit number
    14. Public Const ERROR_SUCCESS = 0&
    15.  
    16. Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, _
    17. phkResult As Long) As Long
    18.  
    19. Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    20.  
    21. Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, _
    22. ByVal lpName As String, ByVal cbName As Long) As Long
    23.  
    24. Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, _
    25. ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    26.  
    27. Public Function GetAllKeys(hKey As Long, strPath As String) As Variant
    28.     ' Returns: an array in a variant of strings
    29.    
    30.     Dim lRegResult As Long
    31.     Dim lCounter As Long
    32.     Dim hCurKey As Long
    33.     Dim strBuffer As String
    34.     Dim lDataBufferSize As Long
    35.     Dim strNames() As String
    36.     Dim intZeroPos As Integer
    37.    
    38.     lCounter = 0
    39.     lRegResult = RegOpenKey(hKey, strPath, hCurKey)
    40.     Do
    41.         'initialise buffers (longest possible length=255)
    42.         lDataBufferSize = 255
    43.         strBuffer = String(lDataBufferSize, " ")
    44.         lRegResult = RegEnumKey(hCurKey, lCounter, strBuffer, lDataBufferSize)
    45.         If lRegResult = ERROR_SUCCESS Then
    46.             'tidy up string and save it
    47.             ReDim Preserve strNames(lCounter) As String
    48.             intZeroPos = InStr(strBuffer, Chr$(0))
    49.             If intZeroPos > 0 Then
    50.                 strNames(UBound(strNames)) = Left$(strBuffer, intZeroPos - 1)
    51.             Else
    52.                 strNames(UBound(strNames)) = strBuffer
    53.             End If
    54.             lCounter = lCounter + 1
    55.         Else
    56.             Exit Do
    57.         End If
    58.     Loop
    59.     GetAllKeys = strNames
    60.  
    61. End Function
    62.  
    63. Public Function GetSettingString(hKey As Long, strPath As String, strValue As String, Optional Default As String) As String
    64.  
    65.     Dim hCurKey As Long
    66.     Dim lValueType As Long
    67.     Dim strBuffer As String
    68.     Dim lDataBufferSize As Long
    69.     Dim intZeroPos As Integer
    70.     Dim lRegResult As Long
    71.    
    72.     ' Set up default value
    73.     If Not IsEmpty(Default) Then
    74.         GetSettingString = Default
    75.     Else
    76.         GetSettingString = ""
    77.     End If
    78.    
    79.     ' Open the key and get length of string
    80.     lRegResult = RegOpenKey(hKey, strPath, hCurKey)
    81.     lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, ByVal 0&, lDataBufferSize)
    82.    
    83.     If lRegResult = ERROR_SUCCESS Then
    84.         If lValueType = [color=red]REG_SZ[/color] Then 'change to the type of value you are looking for (REG_SZ,REG_DWORD,REG_BINARY)
    85.         ' initialise string buffer and retrieve string
    86.             strBuffer = String(lDataBufferSize, " ")
    87.             lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, ByVal strBuffer, lDataBufferSize)
    88.        
    89.             ' format string
    90.             intZeroPos = InStr(strBuffer, Chr$(0))
    91.             If intZeroPos > 0 Then
    92.                 GetSettingString = Left$(strBuffer, intZeroPos - 1)
    93.             Else
    94.                 GetSettingString = strBuffer
    95.             End If
    96.         End If
    97.     Else
    98.         ' there is a problem
    99.     End If
    100.     lRegResult = RegCloseKey(hCurKey)
    101.  
    102. End Function
    You will need to loop through the array of sub keys (from GetAllKeys function) to determine if the Distiller key is present or not.
    Then you can use the second function to get the value if you need it.

    Last edited by RobDog888; Oct 27th, 2003 at 05:08 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  29. #29

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    Thanks again RobDog888!

    I can still not get it working. What exactly do you mean that I should do?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width