| |
|
|
How to add Controls to the Visual Basic 6.0 IDE: |
How to add Controls to the Visual Basic 6.0 IDE:
Select the menu entry Project->Components

Choose the THBImage control in the displayed list

VB adds the THBImage icon to the toolbox.
You can now place it on your form.

All properties are accessible through the property pages.
To open them simply right click on the control and select
the 'Properties' entry

How to license ActiveX Controls:
To license the control go to the 'Registration' property page and
enter your serialnumber into the textbox and press the 'Apply Serialnumber'
button. Serialnumbers do not contain blanks or quotation marks and they are case sensitive.
Serialnumbers look like this:
User1|IMG450123455678
User2|IMG4501A23CE4D5
User3|IMG4501A23CE4D5:User3|IMGEDIT01FE31D9
You can concatenate Serialnumbers by separating them with ':'
For example to license your THBImage control and the Region AddOn
you need to concatenate both Serialnumbers:
THBImage Control: User1|IMG450123455678
Region AddOn: User1|IMGRG4501A23CE4D5
This is the resulting Serialnumber that you must apply:
User1|IMG450123455678:User1|IMGRG4501A23CE4D5

All future THBImage controls that you place on a form will get a
license and do not show any nag screens.
To apply the license to existing THBImage controls
open each form that contains the control and save it once again.
Therefore select File->Save from the VB menu.
Some development environments (like MSAccess and VisualC++) just save the form
when you really change at least one property. Therefore change any THBImage property or
change the size of the control on the form. This ensures that your development environment
really saves the control again.
How to add COM objects to the Visual Basic 6.0 project:
Select the menu entry Project->References

Choose the THBImageEdit COM object in the displayed list

Now you can create new THBImageEdit objects in your VB
source code
Dim ie As New THBImageEdit
How to license COM objects:
To license the COM object you must assign your serialnumber to the
RegistrationKey property of the COM object.
Serialnumbers do not contain blanks or quotation marks and they are case sensitive.
Serialnumbers look like this:
User1|IMG450123455678
User2|IMG4501A23CE4D5
User3|IMG4501A23CE4D5:User3|IMGEDIT01FE31D9
You can concatenate Serialnumbers by separating them with ':'
For example to license your THBImage control and the Region AddOn
you need to concatenate both Serialnumbers:
THBImage Control: User1|IMG450123455678
Region AddOn: User1|IMGRG4501A23CE4D5
This is the resulting Serialnumber that you must apply:
User1|IMG450123455678:User1|IMGRG4501A23CE4D5
Dim ie As New THBImageEdit ie.RegistrationKey = "User3|IMGEDIT4501FE31D9" Dim ie As New THBImageEdit ie.RegistrationKey = "User3|IMG4501A23CE4D5:User3|IMGEDIT4501FE31D9"
You can NOT assign two different Serialnumbers to the RegistrationKey property one after the other, instead of this you can concatenate Serialnumbers as described above:
'WRONG Dim ie As New THBImageEdit ie.RegistrationKey = "User3|IMG4501A23CE4D5" ie.RegistrationKey = "User3|IMGEDIT01FE31D9" 'WRONG
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 serialnumber" '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) <> "\", "\", "") & App.EXEName THBIni.SaveAs THBIni.CreateIniFilename(strAppPath) End Sub
It is necessary to add the Serialnumber 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 Serialnumbers
to EACH INSTANCE of the COM object.
You can simplify the Serialnumbers handling by creating one global function that creates the COM object
and assigns the Serialnumbers:
Global Module
=============
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 <> 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
In VC++ this look something like this:
Global
======
//---------------------------------------------------------------
//
// Create THBImageEdit and assign the serialnumber
//
void CreateTHBImageEdit(ITHBImageEditPtr &ie)
{
//Create THBImageEdit COM object
ie.CreateInstance(__uuidof(THBImageEdit));
//Assign the Serialnumber
ie->PutRegistrationKey("");
}
How to use the CreateTHBImageEdit() function
============================================
BOOL CDialogProfessional::OnInitDialog()
{
CDialog::OnInitDialog();
// Create THBImageEdit and assign the serialnumber
CreateTHBImageEdit(m_ie);
...
}