Mht Unicode C Reference Documentation

Mht

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

Create/Dispose

HCkMhtW CkMhtW_Create(void);

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

void CkMhtW_Dispose(HCkMhtW handle);

Objects created by calling CkMhtW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkMhtW_Dispose.

Callback Functions

Callback Functions are Introduced in Chilkat v9.5.0.56

void CkMhtW_setAbortCheck(HCkHttp cHandle, BOOL (*fnAbortCheck)());

Provides the opportunity for a method call to be aborted. If TRUE is returned, the operation in progress is aborted. Return FALSE to allow the current method call to continue. This callback function is called periodically based on the value of the HeartbeatMs property. (If HeartbeatMs is 0, then no callbacks are made.) As an example, to make 5 AbortCheck callbacks per second, set the HeartbeatMs property equal to 200.

C Example using Callback Functions

void CkMhtW_setPercentDone(HCkHttp cHandle, BOOL (*fnPercentDone)(int pctDone));

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 callback is only called 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 methods 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).

This callback counts as an AbortCheck callback, and takes the place of the AbortCheck event when it fires.

The return value indicates whether the method call should be aborted, or whether it should proceed. Return TRUE to abort, and FALSE to proceed.

void CkMhtW_setProgressInfo(HCkHttp cHandle, void (*fnProgressInfo)(const wchar_t *name, const wchar_t *value));

This is a general callback that provides name/value information about what is happening at certain points during a method call. To see the information provided in ProgressInfo callbacks, if any, write code to handle this event and log the name/value pairs. Most are self-explanatory.

void CkMhtW_setTaskCompleted(HCkHttp cHandle, void (*fnTaskCompleted)(HCkTask hTask));

Called in the background thread when an asynchronous task completes. (Note: When an async method is running, all callbacks are in the background thread.)

Properties

BOOL CkMhtW_getAbortCurrent(HCkMhtW cHandle);

void CkMhtW_putAbortCurrent(HCkMhtW cHandle, BOOL newVal);

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.)

void CkMhtW_getBaseUrl(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putBaseUrl(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_baseUrl(HCkMhtW cHandle);

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.

int CkMhtW_getConnectTimeout(HCkMhtW cHandle);

void CkMhtW_putConnectTimeout(HCkMhtW cHandle, int newVal);

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

void CkMhtW_getDebugHtmlAfter(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putDebugHtmlAfter(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_debugHtmlAfter(HCkMhtW cHandle);

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.

void CkMhtW_getDebugHtmlBefore(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putDebugHtmlBefore(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_debugHtmlBefore(HCkMhtW cHandle);

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.

void CkMhtW_getDebugLogFilePath(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putDebugLogFilePath(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_debugLogFilePath(HCkMhtW cHandle);

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.

BOOL CkMhtW_getDebugTagCleaning(HCkMhtW cHandle);

void CkMhtW_putDebugTagCleaning(HCkMhtW cHandle, BOOL newVal);

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

BOOL CkMhtW_getEmbedImages(HCkMhtW cHandle);

void CkMhtW_putEmbedImages(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getEmbedLocalOnly(HCkMhtW cHandle);

void CkMhtW_putEmbedLocalOnly(HCkMhtW cHandle, BOOL newVal);

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

BOOL CkMhtW_getFetchFromCache(HCkMhtW cHandle);

void CkMhtW_putFetchFromCache(HCkMhtW cHandle, BOOL newVal);

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.

int CkMhtW_getHeartbeatMs(HCkMhtW cHandle);

void CkMhtW_putHeartbeatMs(HCkMhtW cHandle, int newVal);

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.

BOOL CkMhtW_getIgnoreMustRevalidate(HCkMhtW cHandle);

void CkMhtW_putIgnoreMustRevalidate(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getIgnoreNoCache(HCkMhtW cHandle);

void CkMhtW_putIgnoreNoCache(HCkMhtW cHandle, BOOL newVal);

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.

void CkMhtW_getLastErrorHtml(HCkMhtW cHandle, HCkString retval);

const wchar_t *CkMhtW_lastErrorHtml(HCkMhtW cHandle);

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.

void CkMhtW_getLastErrorText(HCkMhtW cHandle, HCkString retval);

const wchar_t *CkMhtW_lastErrorText(HCkMhtW cHandle);

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.

void CkMhtW_getLastErrorXml(HCkMhtW cHandle, HCkString retval);

const wchar_t *CkMhtW_lastErrorXml(HCkMhtW cHandle);

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.

BOOL CkMhtW_getLastMethodSuccess(HCkMhtW cHandle);

void CkMhtW_putLastMethodSuccess(HCkMhtW cHandle, BOOL newVal);

Introduced in version 9.5.0.52

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.

BOOL CkMhtW_getNoScripts(HCkMhtW cHandle);

void CkMhtW_putNoScripts(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getNtlmAuth(HCkMhtW cHandle);

void CkMhtW_putNtlmAuth(HCkMhtW cHandle, BOOL newVal);

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.

int CkMhtW_getNumCacheLevels(HCkMhtW cHandle);

void CkMhtW_putNumCacheLevels(HCkMhtW cHandle, int newVal);

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.

int CkMhtW_getNumCacheRoots(HCkMhtW cHandle);

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.

BOOL CkMhtW_getPreferIpv6(HCkMhtW cHandle);

void CkMhtW_putPreferIpv6(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getPreferMHTScripts(HCkMhtW cHandle);

void CkMhtW_putPreferMHTScripts(HCkMhtW cHandle, BOOL newVal);

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.

void CkMhtW_getProxy(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putProxy(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_proxy(HCkMhtW cHandle);

(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".

void CkMhtW_getProxyLogin(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putProxyLogin(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_proxyLogin(HCkMhtW cHandle);

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

void CkMhtW_getProxyPassword(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putProxyPassword(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_proxyPassword(HCkMhtW cHandle);

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

int CkMhtW_getReadTimeout(HCkMhtW cHandle);

void CkMhtW_putReadTimeout(HCkMhtW cHandle, int newVal);

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.

BOOL CkMhtW_getRequireSslCertVerify(HCkMhtW cHandle);

void CkMhtW_putRequireSslCertVerify(HCkMhtW cHandle, BOOL newVal);

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.

void CkMhtW_getSocksHostname(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putSocksHostname(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_socksHostname(HCkMhtW cHandle);

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).

void CkMhtW_getSocksPassword(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putSocksPassword(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_socksPassword(HCkMhtW cHandle);

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

int CkMhtW_getSocksPort(HCkMhtW cHandle);

void CkMhtW_putSocksPort(HCkMhtW cHandle, int newVal);

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).

void CkMhtW_getSocksUsername(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putSocksUsername(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_socksUsername(HCkMhtW cHandle);

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

int CkMhtW_getSocksVersion(HCkMhtW cHandle);

void CkMhtW_putSocksVersion(HCkMhtW cHandle, int newVal);

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.

BOOL CkMhtW_getUnpackDirect(HCkMhtW cHandle);

void CkMhtW_putUnpackDirect(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getUnpackUseRelPaths(HCkMhtW cHandle);

void CkMhtW_putUnpackUseRelPaths(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getUpdateCache(HCkMhtW cHandle);

void CkMhtW_putUpdateCache(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getUseCids(HCkMhtW cHandle);

void CkMhtW_putUseCids(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getUseFilename(HCkMhtW cHandle);

void CkMhtW_putUseFilename(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getUseIEProxy(HCkMhtW cHandle);

void CkMhtW_putUseIEProxy(HCkMhtW cHandle, BOOL newVal);

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

BOOL CkMhtW_getUseInline(HCkMhtW cHandle);

void CkMhtW_putUseInline(HCkMhtW cHandle, BOOL newVal);

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.

BOOL CkMhtW_getVerboseLogging(HCkMhtW cHandle);

void CkMhtW_putVerboseLogging(HCkMhtW cHandle, BOOL newVal);

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.

void CkMhtW_getVersion(HCkMhtW cHandle, HCkString retval);

const wchar_t *CkMhtW_version(HCkMhtW cHandle);

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

void CkMhtW_getWebSiteLogin(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putWebSiteLogin(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_webSiteLogin(HCkMhtW cHandle);

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

void CkMhtW_getWebSiteLoginDomain(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putWebSiteLoginDomain(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_webSiteLoginDomain(HCkMhtW cHandle);

The optional domain name to be used with NTLM / Kerberos / Negotiate authentication.

void CkMhtW_getWebSitePassword(HCkMhtW cHandle, HCkString retval);

void CkMhtW_putWebSitePassword(HCkMhtW cHandle, const wchar_t *newVal);

const wchar_t *CkMhtW_webSitePassword(HCkMhtW cHandle);

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

Methods

void CkMhtW_AddCacheRoot(HCkMhtW cHandle, const wchar_t *dir);

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".

Download Web Page to MHT with w/ Disk Cache

void CkMhtW_AddCustomHeader(HCkMhtW cHandle, const wchar_t *name, const wchar_t *value);

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.

void CkMhtW_AddExternalStyleSheet(HCkMhtW cHandle, const wchar_t *url);

(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

void CkMhtW_ClearCustomHeaders(HCkMhtW cHandle);

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

void CkMhtW_ExcludeImagesMatching(HCkMhtW cHandle, const wchar_t *pattern);

(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.

BOOL CkMhtW_GetAndSaveEML(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *emlPath);

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.

HCkTaskW CkMhtW_GetAndSaveEMLAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *emlPath);

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

How to Run an Asynchronous Task

BOOL CkMhtW_GetAndSaveMHT(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *mhtPath);

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.

HCkTaskW CkMhtW_GetAndSaveMHTAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *mhtPath);

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

How to Run an Asynchronous Task

BOOL CkMhtW_GetAndZipEML(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *zipEntryFilename, const wchar_t *zipFilename);

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.

HCkTaskW CkMhtW_GetAndZipEMLAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *zipEntryFilename, const wchar_t *zipFilename);

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

How to Run an Asynchronous Task

BOOL CkMhtW_GetAndZipMHT(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *zipEntryFilename, const wchar_t *zipFilename);

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.

HCkTaskW CkMhtW_GetAndZipMHTAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, const wchar_t *zipEntryFilename, const wchar_t *zipFilename);

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

How to Run an Asynchronous Task

BOOL CkMhtW_GetCacheRoot(HCkMhtW cHandle, int index, HCkString outStr);

const wchar_t *CkMhtW_getCacheRoot(HCkMhtW cHandle, int index);

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.

BOOL CkMhtW_GetEML(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, HCkString outStr);

const wchar_t *CkMhtW_getEML(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath);

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.

HCkTaskW CkMhtW_GetEMLAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath);

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

How to Run an Asynchronous Task

BOOL CkMhtW_GetMHT(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath, HCkString outStr);

const wchar_t *CkMhtW_getMHT(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath);

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.

HCkTaskW CkMhtW_GetMHTAsync(HCkMhtW cHandle, const wchar_t *url_or_htmlFilepath);

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

How to Run an Asynchronous Task

BOOL CkMhtW_HtmlToEML(HCkMhtW cHandle, const wchar_t *htmlText, HCkString outStr);

const wchar_t *CkMhtW_htmlToEML(HCkMhtW cHandle, const wchar_t *htmlText);

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.

HCkTaskW CkMhtW_HtmlToEMLAsync(HCkMhtW cHandle, const wchar_t *htmlText);

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

How to Run an Asynchronous Task

BOOL CkMhtW_HtmlToEMLFile(HCkMhtW cHandle, const wchar_t *html, const wchar_t *emlFilename);

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.

HCkTaskW CkMhtW_HtmlToEMLFileAsync(HCkMhtW cHandle, const wchar_t *html, const wchar_t *emlFilename);

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

How to Run an Asynchronous Task

BOOL CkMhtW_HtmlToMHT(HCkMhtW cHandle, const wchar_t *htmlText, HCkString outStr);

const wchar_t *CkMhtW_htmlToMHT(HCkMhtW cHandle, const wchar_t *htmlText);

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.

HCkTaskW CkMhtW_HtmlToMHTAsync(HCkMhtW cHandle, const wchar_t *htmlText);

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

How to Run an Asynchronous Task

BOOL CkMhtW_HtmlToMHTFile(HCkMhtW cHandle, const wchar_t *html, const wchar_t *mhtFilename);

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.

HCkTaskW CkMhtW_HtmlToMHTFileAsync(HCkMhtW cHandle, const wchar_t *html, const wchar_t *mhtFilename);

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

How to Run an Asynchronous Task

BOOL CkMhtW_IsUnlocked(HCkMhtW cHandle);

Returns TRUE if the MHT component is unlocked.

void CkMhtW_RemoveCustomHeader(HCkMhtW cHandle, const wchar_t *name);

Removes a custom header by header field name.

void CkMhtW_RestoreDefaults(HCkMhtW cHandle);

Restores the default property settings.

BOOL CkMhtW_SaveLastError(HCkMhtW cHandle, const wchar_t *path);

Saves the last-error information (the contents of LastErrorXml) to an XML formatted file.

Returns TRUE for success, FALSE for failure.

BOOL CkMhtW_UnlockComponent(HCkMhtW cHandle, const wchar_t *unlockCode);

Unlocks the component allowing for the full functionality to be used. Returns TRUE if the unlock code is valid.

Returns TRUE for success, FALSE for failure.

Diagnosing UnlockComponent Problems

UnlockComponent LastErrorText shows exact string passed to it.

Verify UnlockComponent Success w/ Permanent Unlock Code

LastErrorText Standard Information

BOOL CkMhtW_UnpackMHT(HCkMhtW cHandle, const wchar_t *mhtFilename, const wchar_t *unpackDir, const wchar_t *htmlFilename, const wchar_t *partsSubDir);

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.

BOOL CkMhtW_UnpackMHTString(HCkMhtW cHandle, const wchar_t *mhtString, const wchar_t *unpackDir, const wchar_t *htmlFilename, const wchar_t *partsSubDir);

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

Returns TRUE for success, FALSE for failure.