Mht Delphi DLL Reference Documentation

Mht

Current Version: 10.1.0

Chilkat MHT can generate email objects from HTML files and URLs, and convert HTML to MHT or EML files.

Create/Dispose

var
myObject: HCkMht;

begin
myObject := CkMht_Create();

// ...

CkMht_Dispose(myObject);
end;
function CkMht_Create: HCkMht; stdcall;

Creates an instance of the HCkMht object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

procedure CkMht_Dispose(handle: HCkMht); stdcall;

Objects created by calling CkMht_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Properties

AbortCurrent
function CkMht_getAbortCurrent(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putAbortCurrent(objHandle: HCkMht; newPropVal: wordbool); stdcall;
Introduced in version 9.5.0.58

When set to True, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to False when the next method is called. When the abort occurs, this property is reset to False. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

top
BaseUrl
procedure CkMht_getBaseUrl(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putBaseUrl(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__baseUrl(objHandle: HCkMht): PWideChar; stdcall;

When processing an HTML file or string (not a website URL), this defines the base URL to be used when converting relative HREFs to absolute HREFs.

See the notes about PWideChar memory ownership and validity.

top
ConnectTimeout
function CkMht_getConnectTimeout(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putConnectTimeout(objHandle: HCkMht; newPropVal: Integer); stdcall;

The amount of time in seconds to wait before timing out when connecting to an HTTP server. The default value is 10 seconds.

top
DebugHtmlAfter
procedure CkMht_getDebugHtmlAfter(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putDebugHtmlAfter(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__debugHtmlAfter(objHandle: HCkMht): PWideChar; stdcall;

A filename to save the result HTML when converting a URL, file, or HTML string. If problems are experienced, the before/after HTML can be analyzed to help determine the cause.

See the notes about PWideChar memory ownership and validity.

top
DebugHtmlBefore
procedure CkMht_getDebugHtmlBefore(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putDebugHtmlBefore(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__debugHtmlBefore(objHandle: HCkMht): PWideChar; stdcall;

A filename to save the input HTML when converting a URL, file, or HTML string. If problems are experienced, the before/after HTML can be analyzed to help determine the cause.

See the notes about PWideChar memory ownership and validity.

top
DebugLogFilePath
procedure CkMht_getDebugLogFilePath(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putDebugLogFilePath(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__debugLogFilePath(objHandle: HCkMht): PWideChar; stdcall;

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
DebugTagCleaning
function CkMht_getDebugTagCleaning(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putDebugTagCleaning(objHandle: HCkMht; newPropVal: wordbool); stdcall;

When True causes the Mht class to be much more verbose in its logging. The default is False.

top
EmbedImages
function CkMht_getEmbedImages(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putEmbedImages(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Controls whether images are embedded in the MHT/EML, or whether the IMG SRC attributes are left as external URL references. If false, the IMG SRC tags are converted to absolute URLs (if necessary) and the images are not embedded within the MHT/EML.

top
EmbedLocalOnly
function CkMht_getEmbedLocalOnly(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putEmbedLocalOnly(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, only images found on the local filesystem (i.e. links to files) will be embedded within the MHT.

top
FetchFromCache
function CkMht_getFetchFromCache(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putFetchFromCache(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, page parts such as images, style sheets, etc. will be fetched from the disk cache if possible. The disk cache root may be defined by calling AddCacheRoot. The default value is False.

top
HeartbeatMs
function CkMht_getHeartbeatMs(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putHeartbeatMs(objHandle: HCkMht; newPropVal: Integer); stdcall;

The time interval, in milliseconds, between AbortCheck event callbacks. The heartbeat/AbortCheck provides a means for an application to abort any MHT method before completion.

The default value is 0, which means that no AbortCheck events will be fired.

top
IgnoreMustRevalidate
function CkMht_getIgnoreMustRevalidate(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putIgnoreMustRevalidate(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Some HTTP responses contain a "Cache-Control: must-revalidate" header. If this is present, the server is requesting that the client always issue a revalidate HTTP request instead of serving the page directly from cache. If IgnoreMustRevalidate is set to True, then Chilkat MHT will serve the page directly from cache without revalidating until the page is no longer fresh. (assuming that FetchFromCache is set to True)

The default value of this property is False.

top
IgnoreNoCache
function CkMht_getIgnoreNoCache(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putIgnoreNoCache(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Some HTTP responses contain headers of various types that indicate that the page should not be cached. Chilkat MHT will adhere to this unless this property is set to True.

The default value of this property is False.

top
LastErrorHtml
procedure CkMht_getLastErrorHtml(objHandle: HCkMht; outPropVal: HCkString); stdcall;
function CkMht__lastErrorHtml(objHandle: HCkMht): PWideChar; stdcall;

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastErrorText
procedure CkMht_getLastErrorText(objHandle: HCkMht; outPropVal: HCkString); stdcall;
function CkMht__lastErrorText(objHandle: HCkMht): PWideChar; stdcall;

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastErrorXml
procedure CkMht_getLastErrorXml(objHandle: HCkMht; outPropVal: HCkString); stdcall;
function CkMht__lastErrorXml(objHandle: HCkMht): PWideChar; stdcall;

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastMethodSuccess
function CkMht_getLastMethodSuccess(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putLastMethodSuccess(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Indicate whether the last method call succeeded or failed. A value of True indicates success, a value of False indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = True and failure = False.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to True. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
NoScripts
function CkMht_getNoScripts(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putNoScripts(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Only applies when creating MHT files. Scripts are always removed when creating EML or emails from HTML. If set to True, then all scripts are removed, if set to False (the default) then scripts are not removed.

top
NtlmAuth
function CkMht_getNtlmAuth(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putNtlmAuth(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Setting this property to True causes the MHT component to use NTLM authentication (also known as IWA -- or Integrated Windows Authentication) when authentication with an HTTP server.

The default value of this property is False.

top
NumCacheLevels
function CkMht_getNumCacheLevels(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putNumCacheLevels(objHandle: HCkMht; newPropVal: Integer); stdcall;

The number of directory levels to be used under each cache root. The default is 0, meaning that each cached item is stored in a cache root directory. A value of 1 causes each cached page to be stored in one of 255 subdirectories named "0","1", "2", ..."255" under a cache root. A value of 2 causes two levels of subdirectories ("0..255/0..255") under each cache root. The MHT control automatically creates subdirectories as needed. The reason for mutliple levels is to alleviate problems that may arise when huge numbers of files are stored in a single directory. For example, Windows Explorer does not behave well when trying to display the contents of directories with thousands of files.

top
NumCacheRoots
function CkMht_getNumCacheRoots(objHandle: HCkMht): Integer; stdcall;

The number of cache roots to be used for the disk cache. This allows the disk cache spread out over multiple disk drives. Each cache root is a string indicating the drive letter and directory path. For example, "E:\Cache". To create a cache with four roots, call AddCacheRoot once for each directory root.

top
PreferIpv6
function CkMht_getPreferIpv6(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putPreferIpv6(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, then use IPv6 over IPv4 when both are supported for a particular domain. The default value of this property is False, which will choose IPv4 over IPv6.

top
PreferMHTScripts
function CkMht_getPreferMHTScripts(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putPreferMHTScripts(objHandle: HCkMht; newPropVal: wordbool); stdcall;

This property provides a means for the noscript option to be selected when possible. If PreferMHTScripts = False, then scripts with noscript alternatives are removed and the noscript content is kept. If True (the default), then scripts are preserved and the noscript options are discarded.

top
Proxy
procedure CkMht_getProxy(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putProxy(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__proxy(objHandle: HCkMht): PWideChar; stdcall;

(Optional) A proxy host:port if a proxy is necessary to access the Internet. The proxy string should be formatted as "hostname:port", such as "www.chilkatsoft.com:100".

See the notes about PWideChar memory ownership and validity.

top
ProxyLogin
procedure CkMht_getProxyLogin(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putProxyLogin(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__proxyLogin(objHandle: HCkMht): PWideChar; stdcall;

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

See the notes about PWideChar memory ownership and validity.

top
ProxyPassword
procedure CkMht_getProxyPassword(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putProxyPassword(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__proxyPassword(objHandle: HCkMht): PWideChar; stdcall;

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

See the notes about PWideChar memory ownership and validity.

top
ReadTimeout
function CkMht_getReadTimeout(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putReadTimeout(objHandle: HCkMht; newPropVal: Integer); stdcall;

The amount of time in seconds to wait before timing out when reading from an HTTP server. The ReadTimeout is the amount of time that needs to elapse while no additional data is forthcoming. During a long data transfer, if the data stream halts for more than this amount, it will timeout. Otherwise, there is no limit on the length of time for the entire data transfer.

The default value is 20 seconds.

top
RequireSslCertVerify
function CkMht_getRequireSslCertVerify(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putRequireSslCertVerify(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, then the HTTP client will verify the server's SSL certificate. The certificate is expired, or if the cert's signature is invalid, the connection is not allowed. The default value of this property is False.

top
SocksHostname
procedure CkMht_getSocksHostname(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putSocksHostname(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__socksHostname(objHandle: HCkMht): PWideChar; stdcall;

The SOCKS4/SOCKS5 hostname or IPv4 address (in dotted decimal notation). This property is only used if the SocksVersion property is set to 4 or 5).

See the notes about PWideChar memory ownership and validity.

top
SocksPassword
procedure CkMht_getSocksPassword(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putSocksPassword(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__socksPassword(objHandle: HCkMht): PWideChar; stdcall;

The SOCKS5 password (if required). The SOCKS4 protocol does not include the use of a password, so this does not apply to SOCKS4.

See the notes about PWideChar memory ownership and validity.

top
SocksPort
function CkMht_getSocksPort(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putSocksPort(objHandle: HCkMht; newPropVal: Integer); stdcall;

The SOCKS4/SOCKS5 proxy port. The default value is 1080. This property only applies if a SOCKS proxy is used (if the SocksVersion property is set to 4 or 5).

top
SocksUsername
procedure CkMht_getSocksUsername(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putSocksUsername(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__socksUsername(objHandle: HCkMht): PWideChar; stdcall;

The SOCKS4/SOCKS5 proxy username. This property is only used if the SocksVersion property is set to 4 or 5).

See the notes about PWideChar memory ownership and validity.

top
SocksVersion
function CkMht_getSocksVersion(objHandle: HCkMht): Integer; stdcall;
procedure CkMht_putSocksVersion(objHandle: HCkMht; newPropVal: Integer); stdcall;

SocksVersion May be set to one of the following integer values:

0 - No SOCKS proxy is used. This is the default.
4 - Connect via a SOCKS4 proxy.
5 - Connect via a SOCKS5 proxy.

top
UnpackDirect
function CkMht_getUnpackDirect(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUnpackDirect(objHandle: HCkMht; newPropVal: wordbool); stdcall;
Introduced in version 9.5.0.47

If True, then the UnpackMHT and UnpackMHTString methods will unpack the MHT directly with no transformations. Normally, the related parts are unpacked to a "parts" sub-directory, and the unpacked HTML is edited to update references to point to the unpacked image and script files. When unpacking direct, the HTML is not edited, and the related parts are unpacked to sub-directories rooted in the directory where HTML file is created (i.e. the unpack directory). When unpacking direct, the "partsSubDir" argument of the UnpackMHT* methods is unused.

Note: It is only possible to directly unpack MHT files where the Content-Location headers DO NOT contain URLs. The MHT must be such that the Content-Location headers of the related items contain relative paths.

Note: The default value of this property is False.

top
UnpackUseRelPaths
function CkMht_getUnpackUseRelPaths(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUnpackUseRelPaths(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Controls whether absolute or relative paths are used when referencing images in the unpacked HTML. The default value is True indicating that relative paths will be used. To use absolute paths, set this property value equal to False.

top
UpdateCache
function CkMht_getUpdateCache(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUpdateCache(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Controls whether the cache is automatically updated with the responses from HTTP GET requests. If True, the disk cache is updated, if False (the default), the cache is not updated.

top
UseCids
function CkMht_getUseCids(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUseCids(objHandle: HCkMht; newPropVal: wordbool); stdcall;

Controls whether CID URLs are used for embedded references when generating MHT or EML documents. If UseCids is False, then URLs are left unchanged and the embedded items will contain "content-location" headers that match the URLs in the HTML. If True, CIDs are generated and the URLs within the HTML are replaced with "CID:" links.

The default value of this property is True.

top
UseFilename
function CkMht_getUseFilename(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUseFilename(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, a "filename" attribute is added to each Content-Disposition MIME header field for each embedded item (image, style sheet, etc.). If False, then no filename attribute is added.

The default value of this property is True.

top
UseIEProxy
function CkMht_getUseIEProxy(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUseIEProxy(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, the proxy host/port used by Internet Explorer will also be used by Chilkat MHT.

top
UseInline
function CkMht_getUseInline(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putUseInline(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If True, an "inline" attribute is added to each Content-Disposition MIME header field for each embedded item (image, style sheet, etc.). If False, then no inline attribute is added.

The default value of this property is True.

top
VerboseLogging
function CkMht_getVerboseLogging(objHandle: HCkMht): wordbool; stdcall;
procedure CkMht_putVerboseLogging(objHandle: HCkMht; newPropVal: wordbool); stdcall;

If set to True, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is False. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
procedure CkMht_getVersion(objHandle: HCkMht; outPropVal: HCkString); stdcall;
function CkMht__version(objHandle: HCkMht): PWideChar; stdcall;

Version of the component/library, such as "9.5.0.94"

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
WebSiteLogin
procedure CkMht_getWebSiteLogin(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putWebSiteLogin(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__webSiteLogin(objHandle: HCkMht): PWideChar; stdcall;

(Optional) Specifies the login if a a Web page is accessed that requires a login

See the notes about PWideChar memory ownership and validity.

top
WebSiteLoginDomain
procedure CkMht_getWebSiteLoginDomain(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putWebSiteLoginDomain(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__webSiteLoginDomain(objHandle: HCkMht): PWideChar; stdcall;

The optional domain name to be used with NTLM authentication.

See the notes about PWideChar memory ownership and validity.

top
WebSitePassword
procedure CkMht_getWebSitePassword(objHandle: HCkMht; outPropVal: HCkString); stdcall;
procedure CkMht_putWebSitePassword(objHandle: HCkMht; newPropVal: PWideChar); stdcall;
function CkMht__webSitePassword(objHandle: HCkMht): PWideChar; stdcall;

Optional) Specifies the password if a a Web page is accessed that requires a login and password

See the notes about PWideChar memory ownership and validity.

top

Methods

AddCacheRoot
procedure CkMht_AddCacheRoot(objHandle: HCkMht;
    dir: PWideChar) stdcall;

If disk caching is used, this must be called once for each cache root. For example, if the cache is spread across D:\cacheRoot, E:\cacheRoot, and F:\cacheRoot, an application would setup the cache object by calling AddRoot three times -- once with "D:\cacheRoot", once with "E:\cacheRoot", and once with "F:\cacheRoot".

More Information and Examples
top
AddCustomHeader
procedure CkMht_AddCustomHeader(objHandle: HCkMht;
    name: PWideChar;
    value: PWideChar) stdcall;

Adds a custom HTTP header to all HTTP requests sent by the MHT component. To add multiple header fields, call this method once for each custom header.

top
AddExternalStyleSheet
procedure CkMht_AddExternalStyleSheet(objHandle: HCkMht;
    url: PWideChar) stdcall;

(This method rarely needs to be called.) Includes an additional style sheet that would not normally be included with the HTML. This method is provided for cases when style sheet names are constructed and dynamically included in Javascript such that MHT .NET cannot know beforehand what stylesheet to embed. MHT .NET by default downloads and embeds all stylesheets externally referenced by the HTML

top
ClearCustomHeaders
procedure CkMht_ClearCustomHeaders(objHandle: HCkMht) stdcall;

Removes all custom headers that may have accumulated from previous calls to AddCustomHeader.

top
ExcludeImagesMatching
procedure CkMht_ExcludeImagesMatching(objHandle: HCkMht;
    pattern: PWideChar) stdcall;

(This method rarely needs to be called.) Tells Chilkat MHT .NET to not embed any images whose URL matches a pattern. Sometimes images can be referenced within style sheets and not actually used when rendering the page. In cases like those, the image will appear as an attachment in the HTML email. This feature allows you to explicitly remove those images from the email so no attachments appear.

top
GetAndSaveEML
function CkMht_GetAndSaveEML(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    emlPath: PWideChar): wordbool; stdcall;

Creates an EML file from a web page or HTML file. All external images and style sheets are downloaded and embedded in the EML file.

Returns True for success, False for failure.

top
GetAndSaveEMLAsync (1)
function CkMht_GetAndSaveEMLAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    emlPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetAndSaveEML method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
GetAndSaveMHT
function CkMht_GetAndSaveMHT(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    mhtPath: PWideChar): wordbool; stdcall;

Creates an MHT file from a web page or local HTML file. All external images, scripts, and style sheets are downloaded and embedded in the MHT file.

Returns True for success, False for failure.

top
GetAndSaveMHTAsync (1)
function CkMht_GetAndSaveMHTAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    mhtPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetAndSaveMHT method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
GetAndZipEML
function CkMht_GetAndZipEML(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    zipEntryFilename: PWideChar;
    zipFilename: PWideChar): wordbool; stdcall;

Creates an EML file from a web page or HTML file, compresses, and appends to a new or existing Zip file. All external images and style sheets are downloaded and embedded in the EML.

Returns True for success, False for failure.

top
GetAndZipEMLAsync (1)
function CkMht_GetAndZipEMLAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    zipEntryFilename: PWideChar;
    zipFilename: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetAndZipEML method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
GetAndZipMHT
function CkMht_GetAndZipMHT(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    zipEntryFilename: PWideChar;
    zipFilename: PWideChar): wordbool; stdcall;

Creates an MHT file from a web page or HTML file, compresses, and appends to a new or existing Zip file. All external images and style sheets are downloaded and embedded in the MHT.

Returns True for success, False for failure.

top
GetAndZipMHTAsync (1)
function CkMht_GetAndZipMHTAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    zipEntryFilename: PWideChar;
    zipFilename: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetAndZipMHT method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
GetCacheRoot
function CkMht_GetCacheRoot(objHandle: HCkMht;
    index: Integer;
    outStr: HCkString): wordbool; stdcall;
function CkMht__getCacheRoot(objHandle: HCkMht;
    index: Integer): PWideChar; stdcall;

Returns the Nth cache root (indexing begins at 0). Cache roots are set by calling AddCacheRoot one or more times.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetEML
function CkMht_GetEML(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMht__getEML(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar): PWideChar; stdcall;

Creates EML from a web page or HTML file, and returns the EML (MIME) message data as a string.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetEMLAsync (1)
function CkMht_GetEMLAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetEML method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
GetMHT
function CkMht_GetMHT(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMht__getMHT(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar): PWideChar; stdcall;

Creates MHT from a web page or local HTML file, and returns the MHT (MIME) message data as a string

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetMHTAsync (1)
function CkMht_GetMHTAsync(objHandle: HCkMht;
    url_or_htmlFilepath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the GetMHT method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
HtmlToEML
function CkMht_HtmlToEML(objHandle: HCkMht;
    htmlText: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMht__htmlToEML(objHandle: HCkMht;
    htmlText: PWideChar): PWideChar; stdcall;

Creates an in-memory EML string from an in-memory HTML string. All external images and style sheets are downloaded and embedded in the EML string that is returned.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
HtmlToEMLAsync (1)
function CkMht_HtmlToEMLAsync(objHandle: HCkMht;
    htmlText: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the HtmlToEML method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
HtmlToEMLFile
function CkMht_HtmlToEMLFile(objHandle: HCkMht;
    html: PWideChar;
    emlFilename: PWideChar): wordbool; stdcall;

Creates an EML file from an in-memory HTML string. All external images and style sheets are downloaded and embedded in the EML file.

Returns True for success, False for failure.

top
HtmlToEMLFileAsync (1)
function CkMht_HtmlToEMLFileAsync(objHandle: HCkMht;
    html: PWideChar;
    emlFilename: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the HtmlToEMLFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
HtmlToMHT
function CkMht_HtmlToMHT(objHandle: HCkMht;
    htmlText: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMht__htmlToMHT(objHandle: HCkMht;
    htmlText: PWideChar): PWideChar; stdcall;

Creates an in-memory MHT web archive from an in-memory HTML string. All external images and style sheets are downloaded and embedded in the MHT string.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
HtmlToMHTAsync (1)
function CkMht_HtmlToMHTAsync(objHandle: HCkMht;
    htmlText: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the HtmlToMHT method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
HtmlToMHTFile
function CkMht_HtmlToMHTFile(objHandle: HCkMht;
    html: PWideChar;
    mhtFilename: PWideChar): wordbool; stdcall;

Creates an MHT file from an in-memory HTML string. All external images and style sheets are downloaded and embedded in the MHT file.

Returns True for success, False for failure.

top
HtmlToMHTFileAsync (1)
function CkMht_HtmlToMHTFileAsync(objHandle: HCkMht;
    html: PWideChar;
    mhtFilename: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the HtmlToMHTFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
LoadTaskCaller
function CkMht_LoadTaskCaller(objHandle: HCkMht;
    task: HCkTask): wordbool; stdcall;
Introduced in version 9.5.0.80

Loads the caller of the task's async method.

Returns True for success, False for failure.

top
RemoveCustomHeader
procedure CkMht_RemoveCustomHeader(objHandle: HCkMht;
    name: PWideChar) stdcall;

Removes a custom header by header field name.

top
RestoreDefaults
procedure CkMht_RestoreDefaults(objHandle: HCkMht) stdcall;

Restores the default property settings.

top
UnpackMHT
function CkMht_UnpackMHT(objHandle: HCkMht;
    mhtFilename: PWideChar;
    unpackDir: PWideChar;
    htmlFilename: PWideChar;
    partsSubDir: PWideChar): wordbool; stdcall;

Unpacks the contents of a MHT file. The destination directory is specified by unpackDir. The name of the HTML file created is specified by htmlFilename, and supporting files (images, javascripts, etc.) are created in partsSubDir, which is automatically created if it does not already exist.

Returns True for success, False for failure.

More Information and Examples
top
UnpackMHTString
function CkMht_UnpackMHTString(objHandle: HCkMht;
    mhtString: PWideChar;
    unpackDir: PWideChar;
    htmlFilename: PWideChar;
    partsSubDir: PWideChar): wordbool; stdcall;

Same as UnpackMHT, except the MHT is passed in as an in-memory string.

Returns True for success, False for failure.

More Information and Examples
top

Events

Chilkat supports event callbacks for the Delphi DLL starting in version 9.5.0.82.

AbortCheck
function MyAbortCheck(): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the opportunity for a method call to be aborted. The AbortCheck event is fired periodically based on the value of the HeartbeatMs property. If HeartbeatMs is 0, then no AbortCheck events will fire. As an example, to fire 5 AbortCheck events per second, set the HeartbeatMs property equal to 200. Return True to abort; return False to continue (not abort)

More Information and Examples
top
PercentDone
function MyPercentDone(pctDone: Integer): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This event is only fired when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For operations (Chilkat method calls) that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

The PercentDone callback counts as an AbortCheck event. For method calls that complete quickly such that PercentDone events fire, it may be that AbortCheck events don't fire because the opportunity to abort is already provided in the PercentDone callback. For time consuming operations, where the amount of time between PercentDone callbacks are long, AbortCheck callbacks may be used to allow for the operation to be aborted in a more responsive manner.

Return True to abort; return False to continue (not abort)

More Information and Examples
top
ProgressInfo
procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
Introduced in version 9.5.0.82

A general name/value event that provides information about what is happening during a method call. To find out what information is available, write code to handle this event and log the name/value pairs. Most are self-explanatory.

More Information and Examples
top
TaskCompleted
procedure MyTaskCompleted(task: HCkTask) cdecl;
Introduced in version 9.5.0.82

Called in the background thread when an asynchronous task completes.

top