CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2000
    Location
    Tallahassee, FL
    Posts
    121

    Registry Question

    All I want to do is grab the string value at the following registry path:

    HKEY_LOCAL_MACHINE/SOFTWARE/JJIS/OLE_COMREG

    I guess there is no way to use VB's GetSetting Method and that you must use the methods provided by a VB Module that comes with VB.

    My problem is that I cannot add the module to my project. I need to get this key within a class. This class cannot use any other DLL's, Modules, Forms, etc.

    The reason for this is because the class is used as an MTS object and I do not want it to use anthing else but itself.

    Is there any way I could just define the 1 function I need to use and use it within my class? And if so which function, etc would I need to put in it?

    Thankx,


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Registry Question

    Import the RegQueryValue() as below:
    Private Declare Function RegQueryValue Lib "advapi32.dll" Alias "RegQueryValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpValue As String, lpcbValue As Long) As Long

    and note on the common KEYs:
    Private Const HKEY_CLASSES_ROOT = &H80000000
    Private Const HKEY_CURRENT_CONFIG = &H80000005
    Private Const HKEY_CURRENT_USER = &H80000001
    Private Const HKEY_DYN_DATA = &H80000006
    Private Const HKEY_LOCAL_MACHINE = &H80000002
    Private Const HKEY_PERFORMANCE_DATA = &H80000004
    Private Const HKEY_USERS = &H80000003


    -Cool Bizs

    Good Luck,
    -Cool Bizs

  3. #3
    Join Date
    Jan 2000
    Location
    Tallahassee, FL
    Posts
    121

    Re: Registry Question

    This sounds good. Could you show me an example as to how I can call this function to get the string value back from this location.

    HKEY_LOCAL_MACHINE/SOFTWARE/JJIS/OLE_COMREG

    Thankx,


  4. #4
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Registry Question

    Well I did more searching on the function. The RegQueryValue() will only return you the DEFAULT value of a key and not the others. I've found a post on this forum that might help you. I've experimented with it and it worked but need a little tweaking to what you want. Anyway, check it out:
    http://www.codeguru.com/cgi-bin/bbs/...age=0&Limit=25

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured