Results 1 to 3 of 3

Thread: Possible to read from registry without API?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    30

    Possible to read from registry without API?

    I dont want to use the getsettings functions etc. as i am trying to determine the version of office installed using the registry, and im not having much luck with the API calls...i am simply trying to determine the existance of a key. the relevent code is as follows:

    Const KEY_QUERY_VALUE = &H1
    Const HKEY_LOCAL_MACHINE = &H80000002
    Const ERROR_SUCCESS = 0&

    Private Declare Function RegOpenKeyEx Lib "AdvApi32" (ByVal Hkey As Long, ByVal lpsubkey As String, ByVal uloptions As Long, ByVal samDesired As Long, ByVal phkresult As Long) As Long

    <and later down in the function to determin version:>

    Success = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Office\9.0", 0, KEY_QUERY_VALUE, Presult)
    If Success = ERROR_SUCCESS Then MsgBox "2000" Else MsgBox "98,97"

    ---------------------------------------------
    The Erorr message i am getitng is :
    Cant find DLL Entry Point RegOpenKeyEx in AdvApi32

    Have read help contents, but havent been able to solve, all help appreciated.

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Try this declaration:

    VB Code:
    1. Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    Megatron
    Guest
    You can't access a custom part of the registry without API. If you don't want to use API, use the SaveSetting and GetSetting functions, but they can only save in a specified path.

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