Download THBImage image and vector viewing and processing SDK
Download THBImage image and vector viewing and processing SDK

THBImage Viewer is a small and fast raster picture and vector data viewer.
THBImage Viewer is a small and fast raster picture and vector data viewer.

THBRegistry F.A.Q
THBRegistry F.A.Q

I have tried to access a Windows 98 registry remotely but I get this message “Error connecting to the remote computer - a DLL initialization routine failed”

You need to enable remote administration and remote registry services on the Windows 98 machine. Please refer to the Microsoft Knowledge Base articles Q141460 and Q148308. Microsoft’s regedit should display a similar error when you use regedit to connect to the registry of another computer.

Using ValueGet method, how do I retrieve from the registry a data value when the name shows (Default)?

The registry consists of keys and values. Each value has a name and a value. Keys have a name and a default value. This default value is the same as a normal value. You can access the default value by opening the key and using an empty string to get the default value of the key.

On Error Resume Next
THBReg.KeyOpen , "HKEY_CLASSES_ROOT\.txt"
If Err.Number = 0 Then
    Dim var As Variant
    var = THBReg.ValueGet("")
    ...
End If

I use THBRegistry for some straightforward registry read, create, delete operations. Running the program as an administrator it works fine ( ditto on a win 95 machine and also a win 2000 machine ). When I log in to the NT PC as a user, the program comes up with the error ‘Error -2147352567 KeyCreate: Access is denied’

When you use the KeyCreate method of THBRegistry you will use the default security access mask and this is thbSAMKEYALLACCESS. Maybe the user account doesn’t have enough rights on the registry key to use ALLACCESS Therefore always try to use the ‘lowest’ possible security access mask necessary for the operation, for example: thbSAMKEYREAD or thbSAMKEYWRITE

To take a look at the security rights that are available for a registry key you can use the tool ‘regedt32’. It is very similar to the more common ‘regedit’ and it includes security related operations. So start ‘regedt32’ Select the key that you try to access. In the menu ‘Security->Permissions’ you can see which rights are granted to your user account.

I don’t know how to add the thbreg30.dll to my VC++ 6.0 project!

The setup contains a cpp example too.

Copy the THBRegistry wrapper file THBReg30.h into your c++ project

Include the file THBReg30.h somewhere into your cpp file #include "THBReg30.h" //THBRegistry Wrapper

ITHBRegistryPtr is a smartpointer that handles reference counting for you.

To create the object:

ITHBRegistryPtr pReg;
pReg.CreateInstance(__uuidof(THBRegistry));

or use the provided function (Globals.h)

ITHBRegistryPtr pReg;
// Create the THBRegistry object
pReg = CreateTHBRegistry();

The compiler can create the wrapper on its own too #import "C:\Prog\THBRegistry30\THBReg30.dll" no_namespace