QHTM_RenderHTML
BOOL WINAPI QHTM_RenderHTML( HDC hdc, LPCTSTR pcsz, HINSTANCE hInst, UINT uSource, UINT uWidth );
Given a width determine draw some HTML. The HTML content can be text, a file or resources
Parameters
- hdc
- Device context use for drawing.
- pcsz
- Name of resource, name of file or HTML content. Meaning depends on uSource.
- hInst
- Instance handle to be used when loading from resources.
- uSource
-
QHTM_SOURCE_TEXT
- pcsz is the HTML text to use. hInst is ignored.QHTM_SOURCE_RESOURCE
- pcsz is the name of a resource and hInst is the instance handle to use.QHTM_SOURCE_FILENAME
- pcsz is the name of a file to load. hInst is ignored.
- uWidth
- Constraining width.
Return value
non-zero if it succeeds.
It could fail because the filename passed was incorrect or because the resources passed were incorrect
Example
This code has been taken from the example program, source file SaveAsBitmap.cpp.
//
// We set a maximum width just to be sure...
const UINT uMaxWidth = 600;
HDC hdcWindow = ::GetDC( hwndParent );
HDC hdcDraw = ::CreateCompatibleDC( hdcWindow );
UINT uHeight = 0;
if( QHTM_GetHTMLHeight( hdcDraw, pcszHTMLFilename, NULL, QHTM_SOURCE_FILENAME, uMaxWidth, &uHeight ) )
{
//
// Now we have a width and a height...
HGDIOBJ hbmp = ::CreateCompatibleBitmap( hdcWindow, uMaxWidth, uHeight );
if( hbmp )
{
//
// Select the bitmap and render the HTML onto it.
hbmp = ::SelectObject( hdcDraw, hbmp );
if( QHTM_RenderHTML( hdcDraw, pcszHTMLFilename, NULL, QHTM_SOURCE_FILENAME, uMaxWidth ) )
{
//
// Deselect the bitmap
hbmp = ::SelectObject( hdcDraw, hbmp );
SaveBitmapAsFile( hbmp, pcszBMPFilename );
}
}
(void)::DeleteObject( hbmp );
}
(void)::ReleaseDC( hwndParent, hdcWindow );
(void)::DeleteDC( hdcDraw );
(void)::SetCursor( hOld );
See also QHTM_GetHTMLHeight
See also QHTM_RenderHTMLRect