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.

General F.A.Q
General F.A.Q

What is a lightweight ATL ActiveX Control?

ATL is a technology to develop ActiveX Controls with C++. This means that the resulting Controls will be extreme fast. Another advantage is that they do not need any big runtime dll’s. If you create the Control for example with Visual Basic the resulting control needs the VB Runtime dll’s. If you create the Control for example with MFC the resulting control needs the MFC dll’s.

How to register ActiveX Controls?

Use the tool regsvr32.exe found in the windows system directory to register or unregister dll or ocx files. If you encounter problems when registering a file, you must ensure that all dll’s that are necessary for this file are installed and registered too. Why registering ActiveX Controls: Before an ActiveX control can be used in your distributed application, it must be included in the Windows Registry. As a developer, you are responsible for registering the ActiveX control.

Which Development environments(ActiveX Containers) are supported:

We concentrate our development on Visual Basic 5.0 & 6.0 and Visual C++ 5.0 & 6.0. Nevertheless our Controls and COM Objects may work in other environments too. (Access, Delphi, Borland C++ Builder, …)

How to use the License File? (ActiveX Controls)

After purchasing a license for the control you get a file per E-Mail. The name of the file is the same as the name of the control file. Only the extension differs, it is called ‘.lic’. You must copy this file into the folder where the control is. The control automatically detects it and the nag screen doesn’t appear any more.

If you have more than one copy of the ActiveX control dll (THBImg30.dll, THBRes25.dll, ..) on your system you must use the folder where the registered dll lies. Registered dll means: the dll that is entered in the windows registry You can simply reregister the dll once again by entering ‘regsvr32 C:\YourPath\THBRes25.dll’ at the command prompt. In this way you can define by yourself which one the registered dll is.

The setup installs and registers the ActiveX control dlls into the application folder that you can specify in the setup. By default this is: “C:\Programs\THB Componentware\THBResize\THBResXX.dll” Save the license file into: “C:\Programs\THB Componentware\THBResize\THBResXX.LIC”

When you open up the form containing the THBResize control the next time the nag screen will not appear any more.

If the nag screen still appears then there are two different possibilities causing the problem. Either it is an invalid license file or you placed the license file into a wrong directory.

You may find the THBResXX.dll in one of these three folders: “C:\Windows\System\THBResXX.dll” “C:\Programs\THB Componentware\THBResize\THBResXX.dll” “C:\Programs\THB Componentware\THBImage\THBResXX.dll”

You can now copy the license file into each folder where you find the THBResXX.dll to ensure that each dll finds the THBResXX.LIC license file.

Or you can register the dll that you prefer: “regsvr32.exe C:\Programs\THB Componentware\THBResize\THBResXX.dll” And ensure that the license file “C:\Programs\THB Componentware\THBResize\THBResXX.LIC” exists.

How to use the License Key? (AtiveX COM Objects)

After purchasing a license for the COM Object you get a License-Key-File per E-Mail. Its only use is to get the RegistrationKey String. You don’t have to copy the file somewhere on your harddisk. The following code sample is from the THBIniFileSimple example, there is only one new line inserted:

Private Sub Form_Unload(Cancel As Integer)
	'Please ensure that THBIniFile 3.0 Type Library is added to the project:
	'Project->References...
	'Creates a new THBIniFile Object
	Dim THBIni As New THBIniFileLib.THBIniFile
	Dim strAppPath As String

	THBIni.RegistrationKey = "Here comes the License Key"

	'Fill it with entries
	THBIni.EntryCreateOrReplace "Form", "Left", Me.Left
	THBIni.EntryCreateOrReplace "Form", "Top", Me.Top
	THBIni.EntryCreateOrReplace "Form", "Width", Me.Width
	THBIni.EntryCreateOrReplace "Form", "Height", Me.Height
	'Save it
	strAppPath = App.Path & IIf(Right(App.Path, 1) &lt&gt "\", "\", "") & App.EXEName
	THBIni.SaveAs THBIni.CreateIniFilename(strAppPath)

End Sub

It is necessary to add the license key to the source code and compile it into the executeable file. If you create more than one instance of the COM object then you must assign the license key to each instance of the COM object. You can simplify the license key handling by creating one global function that creates the COM object and assigns the license key:

### Global Modul

	Option Explicit

	'THBRegistry License Key
	Const gstrTHBRegistryLicKey = "Your Key"

	'------------------------------
	'Create the THBRegistry object
	'------------------------------
	Public Function CreateTHBRegistry() As THBRegistryLib.THBRegistry
		'Please ensure that THBRegistry Type Library is added to the project:
		'Project->References...
		Dim THBReg As New THBRegistryLib.THBRegistry
		THBReg.RegistrationKey = gstrTHBRegistryLicKey
		Set CreateTHBRegistry = THBReg
	End Function

### How to use the CreateTHBRegistry() function

	Option Explicit

	'----------------------
	' This simple demo shows you how to save the form position
	' to the Registry and how to load it at program startup
	'----------------------
	Private Sub Form_Load()
		'Please ensure that THBRegistry Type Library is added to the project:
		'Project->References...
		Dim THBReg As THBRegistryLib.THBRegistry
		
		'Create the THBRegistry object
		Set THBReg = CreateTHBRegistry()
		
		On Error Resume Next
		THBReg.KeyOpen , "HKEY_LOCAL_MACHINE\Software\" + "THBRegistry\Vb\SimpleDemo\Form"
		If Err.Number &lt&gt 0 Then
			'Registry Entries don't exist
			'If they don't exist, they will automatically be created in Form_Unload
			'This is the right place to specify default values
		Else
			Dim var As Variant
			var = THBReg.ValueGet("Left", thbDataTypeDouble): If Not IsEmpty(var) Then Me.Left = var: var = Empty
			var = THBReg.ValueGet("Top", thbDataTypeDouble): If Not IsEmpty(var) Then Me.Top = var: var = Empty
			var = THBReg.ValueGet("Width", thbDataTypeDouble): If Not IsEmpty(var) Then Me.Width = var: var = Empty
			var = THBReg.ValueGet("Height", thbDataTypeDouble): If Not IsEmpty(var) Then Me.Height = var: var = Empty
			
		End If
		On Error GoTo 0
		
	End Sub

	Private Sub Form_Unload(Cancel As Integer)
		'Please ensure that THBRegistry Type Library is added to the project:
		'Project->References...
		Dim THBReg As THBRegistryLib.THBRegistry
		
		'Create the THBRegistry object
		Set THBReg = CreateTHBRegistry()
		
		On Error Resume Next
		THBReg.KeyCreate , "HKEY_LOCAL_MACHINE\Software\" + "THBRegistry\Vb\SimpleDemo\Form"
		If Err.Number = 0 Then
			THBReg.ValueCreate "Left", Me.Left
			THBReg.ValueCreate "Top", Me.Top
			THBReg.ValueCreate "Width", Me.Width
			THBReg.ValueCreate "Height", Me.Height
		End If
		On Error GoTo 0
		
	End Sub

What kind of algorithm/technology do you use for the encryption?

To protect your sensitive data we use the AES strong encryption algorithm supporting
128, 192, 256bit encryption keys. The AES also known as Rijndael is a very fast block cipher
encryption algorithm and is officially identified as an approved encryption algorithm that can 
be used by U.S. Government organizations to protect their sensitive information.

What is the key length? When you store passwords encrypted then you need to define your encryption key. The length of this hexadecimal key defines the ‘key length’ and this actually defines the encryption strength.

The encryption key must be a string just containing hexadecimal digits. That means that you can only use characters from ‘0’ - ‘9’ or ‘a’ - ‘f’. It should range from 32 to a maximum of 64 characters long.

32 characters leads to 16 hexadecimal bytes. This results in 16*8 = 128bit encryption. 48 characters leads to 24 hexadecimal bytes. This results in 24*8 = 192bit encryption. 64 characters leads to 32 hexadecimal bytes. This results in 32*8 = 256bit encryption.

Internally the algorithm just deals with 128,192,256 Bit key length. The missing bits are filled up to get a key length of at least 128bit.

128bit key: “0123456789abcdef0123456789abcdef” 192bit key: “0123456789abcdef0123456789abcdef” + “0123456789abcdef” 256bit key: “0123456789abcdef0123456789abcdef” + “0123456789abcdef0123456789abcdef”

You must pass the same key to retrieve a value (ValueGet) and to create a value (ValueCreate). Example: ‘This encryption key will be used to encrypt the password ‘NOTE: This must be a hexadecimal string. ’ That means that you must use characters from ‘0’ - ‘9’ or ‘a’ - ‘f’ ’ It should be from 32 to a maximum of 64 characters long ’ 32 characters leads to 16 hexadecimal bytes. This results in 16*8 = 128bit encryption Const gstrEncryptionKey As String = “0123456789abcdef0123456789abcdef”

var = THBReg.ValueGet("Password", thbDataTypeString, gstrEncryptionKey): If Not IsEmpty(var) Then Me.tbPassword = var: var = Empty
THBReg.ValueCreate "Password", Me.tbPassword.Text, , gstrEncryptionKey

We downloaded THBImage but we cannot read the help file format, it has the extension .CHM. Could you tell us which reader to use?

CHM files are the new Microsoft HTML Help files. More and more applications use them and you maybe need it for other applications too. So it should not be wasted time to install the htmlhelp-files. You can download them directly from Microsoft at the following link: htmlhelp/wkshp/download.htm If you do not want to install it, you can download the HTML Documentation. It contains the documentation for THBImage, THBRegistry, THBRotatedLabel, THBResize. (Open the ‘Index.html’ file contained in the thbdoc.zip)

When I try to run my application containing THBImage, I get an error message similar to this: Failed to load control THBImage from “thbimg30.dll”.

Your version of thbimg30.dll
may be outdated. Make sure you are using the version of the control that was provided with your application.

What the error means is that you have at least one outdated version of an OCX or dll in your Windows/System folder. To redistribute THBImage you must add the thbimg30.dll to your setup. And you need an up to date version of the Ole dlls olepro32 and oleaut32

  • OLEPRO32.DLL - 5.0.4275 Register with regsvr32
  • OLEAUT32.DLL - 2.40.4275 Register with regsvr32
  • THBImg30.dll ActiveX Control Register with regsvr32

When you compile your application with thbimg30.dll version 3.0.0.4 then you must add a thbimg30.dll to your setup that has the same or a higher version number.

I am getting a Runtime error 429 (ActiveX Component can’t create object)

You get this error if your ActiveX control or COM object is not registered in the registry. You can solve your problem with the following command: regsvr32 c:\YourPath\THBImE20.dll This command registers the dll again.

You get the same error when you move the dll to a different folder or if you rename it. regsvr32 c:\YourPath\THBImE20.dll Rename or move the folder YourPath to NewYourPath And you will get the error too because c:\YourPath\THBImE20.dll is an invalid path.

Running ActiveX controls and COM objects in a Terminal Server environment

In a Terminal Server environment it may be necessary to install the control and register it on each of the Terminal Servers in addition to the server on which the program itself resides.

Which COM dll is in use?

Copying a COM dll on your harddisk is not sufficient. You need to register it by calling regsvr32 c:\yourpath\Your.dll Now the registry contains ClassID entries for all COM components and a key that points to the dll on your harddisk. [HKEYCLASSESROOT \ CLSID \ {E5918D9D-0702-4D65-AF8C-EA1EC4CCA9FA} \ InprocServer32] = c:\yourpath\Your.dll

When you now create the COM object in VB the system will use this path to load the dll. In general, the path specified there points to the com dll that will be used by all applications. There are various techniques to overrule this path: Local dll files Some installation program techniques to enforce specific dll versions Shared dll Windows search order Some special Registry keys for affecting the dll search order Windows ServicePacks

How can you find out which dll your application uses: Use the ‘Depends’ tool from the product CD and profile your application, it will list filename and path of all loaded dlls. Use the windows explorer to search all dlls on all of your local harddisk. Remove them all. Just the one that is in use will be locked and can’t be removed. While running the application from within your IDE most development environment list all loaded dlls.

MSI Windows Installer troubles

If an “Error 1316. A network error occurred” appears during installation like this: Error 1316. A network error occurred while attempting to read from the file C:\Program Files\Common Files\Wise Installation Wizard\LONGSTRANGENAME01234.msi then there are many possible reasons that can cause this.

It probably means that the THBImage Runtime package is already installed, perhaps as a different user. Either use the current installation or deinstall it and reinstall.

Windows Installer Maybe you need an updated MSI installer. Therefore please visit the microsoft.com page go to the Downloads section and search for ‘Windows Installer’ Or use this direct link: InstMsiW.exe

If problems persist you might need to use Microsoft’s free installation cleanup utility. It is just a simple tool easy to install and run. scid=kb;en-us;290301 They mention that this could cause troubles and you need to reinstall Windows Installer afterwards so be careful.