Get a registry string....

Ok, here is the situation.... I want to get a string from the registry... the string is  -

HKEY_LOCAL_MACHINE\Software\Netscape\Netscape Navigator\CurrentVersion

Where CurrentVersion  is the string.  Now,  I've tried RegGetValue, GetRegKeyValue, and they both said "undeclared identifier"  :(

Can you please provide a working way to get the string of the location specified above.. I would really appreciate it.

I would offer more, but I dont have any more points.. :(

Thanks.
Nitro187Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jkrConnect With a Mentor Commented:
Use the following code:

    HANDLE  hKey;
    char    acVersion [ MAX_VERSION];
    DWORD   dwType  =   REG_SZ;
    DWORD   dwSize  =   sizeof  (   acVersion);

    if  (   ERROR_SUCCESS   ==  RegOpenKeyEx    (    HKEY_LOCAL_MACHINE,
                                                     "Software\\Netscape\\Netscape Navigator",
                                                     0,
                                                     KEY_QUERY_VALUE,
                                                    &hKey
                                                )
        )
        {
          // error
        }

    if  (   ERROR_SUCCESS   !=  RegQueryValueEx (   hKey,
                                                    "CurrentVersion",
                                                    NULL,
                                                    &dwType,
                                                    ( PUCHAR) acVersion,
                                                    &dwSize
                                                )
        )
        {
          // error
        }


    RegCloseKey ( hKey);

Feel free to ask if you encounter problems!
0
 
Nitro187Author Commented:
Thanks a lot!  :)
0
All Courses

From novice to tech pro — start learning today.