Global Delphi ActiveX Reference Documentation
TChilkatGlobal
Current Version: 10.1.0
Provides a means for updating global settings that affect all types of Chilkat objects across all instances.
Importing the Chilkat ActiveX into Delphi
Important: When upgrading to a new version of Chilkat, make sure to re-imported ActiveX DLL into Delphi to regenerate the files described below.
Chilkat v9.5.*: If using Chilkat v9.5.*, then use "Chilkat_v9_5_0_TLB" instead of "Chilkat_TLB", and the DLLs are named ChilkatAx-9.5.0-win32.dll (or ChilkatAx-9.5.0-x64.dll).
Two things are required to use an ActiveX in Delphi:
- The ActiveX DLL needs to be registered via regsvr32 on the system where the Delphi application runs. See How To Register ActiveX DLLs for detailed information.
- See also: ActiveX Registration Tutorial
- The ActiveX component needs to be "imported". Use the Delphi Import Component Wizard to import the Chilkat type library. This creates the following files: Chilkat_TLB.pas and Chilkat_TLB.dcr. The Chilkat_TLB.pas should be added to your project.
To import the Chilkat type library, do the following:
- In the Delphi RAD Studio, select the menu item "Component" --> "Import a Type Library".
- Find "Chilkat ActiveX" in the list and select it. This will only appear in the list if the ChilkatAx-win32.dll (or ChilkatAx-x64.dll) has been registered w/ regsvr32.
- Check the "Generate Component Wrappers" checkbox.
- Select a directory where the unit files (.pas and .dcr) should be generated.
- Select "Create Unit" and then "Finish".
- Add the .pas to your Delphi project.
To use a Chilkat ActiveX object in your Delphi code, add "Chilkat_TLB" to the "uses" statement. For example:
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
Object Creation
var obj: TChilkatGlobal; ... begin obj := TChilkatGlobal.Create(Self); ... // When finished, free the object instance. obj.Free();
Properties
AnsiCodePage
The default ANSI code page is determined at runtime based on the computer where the application happens to be running. For example, the ANSI code page for an application running on a Japanese computer is likely to be Shift_JIS (code page 932), whereas on a US-English computer it would be iso-8859-1 (or Windows-1252 which is essentially a superset of iso-8859-1).
If there is a desire for the Chilkat library to use a specific ANSI code page regardless of locale, then this property should be set to the desired code page. The default value of this property is the ANSI code page of the local computer.
topAutoQBDecode
If set to 1, then "Q" or "B" encoded strings can be passed in any string argument to any Chilkat method, and Chilkat will automatically decode the string before using it. This is meant to be a convenient way to use non-usascii literal strings in your source code. See the links below for an example and for a discussion about non-usascii literal strings.
DebugLogFilePath
If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.
Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.
Possible causes of hangs include:
- A timeout property set to 0, indicating an infinite timeout.
- A hang occurring within an event callback in the application code.
- An internal bug in the Chilkat code causing the hang.
DefaultNtlmVersion
Selects the default NTLM protocol version to use for NTLM authentication for HTTP, POP3, IMAP, SMTP, and HTTP proxies. The default value is 2. This property may optionally be set to 1.
DefaultUtf8
This applies to programming languages where each class has a Utf8 property and strings are handled as multibyte, null-terminated byte sequences. Relevant languages include the multibyte C/C++ API, Perl, Python 2.*, Ruby, and PHP, but not Java, Objective-C, or Python 3.*, where strings are inherently UTF-8. Languages that handle strings as Unicode objects, such as .NET, are also excluded.
For Chilkat classes, the Utf8 property determines whether strings are returned as UTF-8 or ANSI and guides how Chilkat interprets incoming string arguments. Set this property to 0 if passing ANSI strings, and 1 if using UTF-8 encoded strings.
The global Utf8 property sets the default for all Chilkat objects, allowing an application to run entirely in "UTF-8 mode" or "ANSI mode" without needing to adjust the Utf8 property for each Chilkat object individually.
The default value of this property is 0.
Important: In a future major version release, the default value of this property will change to 1. It is recommended to explicitly set this property at the start of your application.
DnsTimeToLive
If DNS caching is enabled, this is the time-to-live (in seconds) for a cached DNS lookup. A DNS lookup result older than this expiration time is discarded, and causes a new DNS lookup to occur. A value of 0 indicates an infinite time-to-live. The default value of this property is 0.
topEnableDnsCaching
Controls whether DNS domain lookups (to resolve to IP addresses) are cached in memory. The default value is 0, meaning that DNS caching is disabled.
topKeepBinaryResult
If set to 1, then the binary data returned by any method will be persisted in memory in the LastBinaryResult property. This allows for an ActiveX running in the SQL Server environment to access large varbinary return values via temp tables. The method would be called, and then the LastBinaryResult property would be fetched to get the full contents of the returned string.
topKeepStringResult
If set to 1, then the string returned by any method will be persisted in memory in the LastStringResult property. This allows for an ActiveX running in the SQL Server environment to access large string return values via temp tables. The method would be called, and then the LastStringResult property would be fetched to get the full contents of the returned string.
Important: When this property = 1, all Chilkat methods that return strings will return the empty string. The string return value is available in the LastStringResult property.
topLastBinaryResult
This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. It is only accessible if Chilkat.Global.KeepBinaryResult is set to 1. This feature allows for the retrieval of large varbinary results in an SQL Server environment, which has restrictions on returning large data via method calls, though temp tables can handle binary properties.
topLastErrorHtml
Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastErrorText
Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
LastErrorXml
Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastMethodSuccess
Indicates the success or failure of the most recent method call: 1 means success, 0 means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages.
topLastStringResult
In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. It is accessible only when Chilkat.Global.KeepStringResult is set to TRUE. SQL Server has limitations on string lengths returned from methods and properties, but temp tables can be used to access large strings.
LastStringResultLen
The length, in characters, of the string contained in the LastStringResult property.
topMaxThreads
The maximum number of thread pool threads. The default value is 100. The maximum value is 500. Note: Asynchronous worker threads are created on as needed up to the maximum.
PreferIpv6
If 1, then use IPv6 over IPv4 when both are supported for a particular domain. The default value of this property is 0, which will choose IPv4 over IPv6.
Note: Setting this property has the effect of also setting the default value of the PreferIpv6 property for other classes.
topThreadPoolLogPath
If set, indicates the path of a log file to be used by the thread pool thread and each of the pool worker threads for logging async activity. Chilkat always appends to the log file. If the log file already exists, then new information will be appended.
UncommonOptions
This is a catch-all property to be used for uncommon needs. This property defaults to the empty string, and should typically remain empty.
topUnlockStatus
Indicates the unlocked status for the last call to UnlockBundle. The possible values are:
- Not unlocked. (Still in locked state.)
- Unlocked with in fully-functional trial mode.
- Unlocked using a valid purchased unlock code.
Note: If UnlockBundle is called with a purchased unlock code, the UnlockStatus is correctly set to the value 2. This value is intentionally sticky. If a subsequent and redundant call to UnlockBundle happens, it is effectively a "No-Op" because the library is already unlocked. The UnlockStatus will not change.
If however, if the 1st call resulted in UnlockStatus = 1, and THEN the unlock method is called again with a purchased unlock code, the UnlockStatus should change from 1 to 2.
topUsePkcsConstructedEncoding
This property should typically be left at the default value of 0. If set to 1, then Chilkat will use a constructed ASN.1 encoding for PCKS7 data. (This is an internal implementation option that normally does not matter, and should not matter. Some PKCS7 receiving systems might be picky, and this option can be used to satisfy this requirement.)
topVerboseLogging
If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
topVerboseTls
If set to 1, then causes extremely verbose logging (in LastErrorText) all TLS connections in any Chilkat class. This property should only be used for troubleshooting TLS problems. The default value is 0.
Note: This property only has effect on Chilkat objects not yet created. Set the property first, then instantiate the Chilkat object.
topVersion
Methods
DnsClearCache
FinalizeThreadPool
Called to stop and finalize all threads in the thread pool, and causes the thread pool thread to exit.
The following behaviors exist in v9.5.0.64 and later:
- All remaining asynchronous tasks are automatically canceled.
- Restores the thread pool to it's pristine state where no background threads are running.
It is a good idea to call this method at the very end of a program, just before it exits. This is especially true for programs written in VBScript, VB6, FoxPro, and PowerBuilder.
Returns 1 for success, 0 for failure.
topThreadPoolLogLine
UnlockBundle
Unlocks the entire Chilkat API for all classes. This should be called once at the beginning of a program. Once unlocked, objects of any Chilkat class may be instantiated and used. To unlock in fully-functional 30-day trial mode, pass any string, such as "Hello", in bundleUnlockCode. If a license is purchased, then replace the "Hello" with the purchased unlock code.
After calling UnlockBundle once, the instance of the TChilkatGlobal object may be discarded/deleted (assuming the programming language requires explicit deletes). Multiple calls to UnlockBundle are harmless. If the Chilkat API is already unlocked, the duplicate calls to UnlockBundle are no-ops.
Important: Unlocking sets a flag in memory to indicate the unlocked status. There are no licensing files, and there is no communication with any Chilkat servers. This means your application, script, etc. must call UnlockBundle once at the start each time it runs. The good thing is that your application can run on any computer -- there are no licensing files to worry about. Also: If an application forgets to call UnlockBundle, Chilkat will automatically unlock in trial mode, and this will eventually fail when the trial runs out. If you purchased a license, it is very important to make sure you call UnlockBundle with the purchased unlock code.
Returns 1 for success, 0 for failure.