IHTMLDocument2::write Method
--------------------------------------------------------------------------------
Writes one or more HTML expressions to a document in the specified window.
Syntax
HRESULT write(
SAFEARRAY *psarray
);
Parameters
psarray
[in] BSTR that specifies the text and HTML tags to write.
Return Value
Returns S_OK if successful, or an error value otherwise.
Example
This example shows how to write a string to the document.
Hide Example
IHTMLDocument2 *document; // Declared earlier in the code
HRESULT hresult = S_OK;
VARIANT *param;
SAFEARRAY *sfArray;
BSTR bstr = SysAllocString(OLESTR("Written by IHTMLDocument2::write()."));
// Creates a new one-dimensional array
sfArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
if (sfArray == NULL || document == NULL) {
goto cleanup;
}
hresult = SafeArrayAccessData(sfArray,(LPVOID*) & param);
param->vt = VT_BSTR;
param->bstrVal = bstr;
hresult = SafeArrayUnaccessData(sfArray);
hresult = document->write(sfArray);
cleanup:
SysFreeString(bstr);
if (sfArray != NULL) {
SafeArrayDestroy(sfArray);
}
See Also
IHTMLDocument2::writeln, IHTMLDocument2:
pen
--------------------------------------------------------------------------------
© 2001 Microsoft Corporation. All rights reserved. Terms of use.