Ultra small Win32 HTML control.
Using QHTM you can place HTML content on any window, any device context, on a report, on a button or even in a tooltip. QHTM is written entirely in C++ and does not rely on MFC, nor does it need IE installed. Instead QHTM uses direct Win32 API calls which makes it very fast and very light.
The control also provides ability to display QHTM Button, Tooltip or ListBox. Cool Tooltips are enabled by default.
QHTM | Ultra small Win32 HTML control. |
Add | Add QHTM control. |
AddHtml | Add HTML to the current document. |
AdjustControl | Adjust control’s height to fit HTML. |
FormReset | Resets the form |
FormSubmit | Submits the form |
FormSetSubmitCallback | Set the function to call when submitting a form via POST |
GetDrawnSize | Get the width and height of the HTML |
GetHTMLHeight | Given a width determine the height of some HTML. |
GetHTML | Return HTML rendered by the control |
GotoLink | Force the HTML control to scroll to a named linked within a document. |
Init | Initialise the QHTM module. |
LoadFromFile | Load HTML into QHTM passing a valid filename. |
LoadFromResource | Load HTML into QHTM from a resource |
MsgBox | MsgBox replacement |
PrintCreateContext | Create and return a print context. |
PrintDestroyContext | Destroy a valid QHTMCONTEXT. |
PrintSetText | Set the HTML for the given print context. |
PrintSetTextFile | Set the HTML for the given print context using a file. |
PrintLayout | Layout the HTML, using the HDC passed, to determine the number of pages. |
PrintPage | Print a page |
PrintGetHTMLHeight | Given a fixed width it returns the rendered height of the HTML. |
RenderHTML | Render HTML onto a device context. |
RenderHTMLRect | Render HTML onto a device context and confined within a rectangle. |
SetHTMLButton | Change a button so that it can contain HTML as it’s text instead of plain text. |
SetHTMLListbox | Change a listbox so that it’s items can use HTML instead of plain text. |
ShowScrollbars | Set whether or not QHTM will display scrollbars. |
Zoom | Zoom the HTML in or out |
Links | |
About |
QHTM_Add( Hwnd, X, Y, W, H, Text = "", Style = "", Handler = "", DllPath = "" )
Add QHTM control.
Hwnd | Handle of the parent. |
X-H | Control coordinates. |
Text | HTML to display. |
Style | List of control styles, optional. |
Handler | Notification handler, optional. |
DllPath | Path to the control’s dll, optional. By default current folder. |
Border | Add border arond the control. |
Transparent | Make HTML control transparent. |
Controls handle or error message.
Result := Handler(Hwnd, Link, Id)
Hwnd | Handle of the control. |
Link | Link text. |
ID | HTML link ID. |
Result | Return 1 to open the link in system default editor. |
QHTM_AdjustControl( hCtrl )
Adjust control’s height to fit HTML.
hCtrl | Control |
This function is to be used in combination with SetHTMLButton or <SetHTMLListBox>.
QHTM_FormSetSubmitCallback( hCtrl, Fun )
Set the function to call when submitting a form via POST
Fun | Function to be called |
OnQHtmForm(FormName, Method, FieldCount, Fields)
FormName | Name of the form that was submited |
Action | Action of the form |
FieldCount | Number of fields in the form |
Fields | New line separated list of filed names and values. |
QHTM_LoadFromResource( hCtrl, Name, Resource = "" )
Load HTML into QHTM from a resource
Name | Resource name or number. |
Resource | Resource file, leave empty for compiled scripts to use its exe. |
In order to use this feasture you must add resources manually using Resource Hacker or some other resource editor.
QHTM_LoadFromResource(hQhtm, 1) ;load resource with ID=1 from compiled script QHTM_LoadFromResource(hQhtm, "ABOUT.HTML", "res.dll") ; load resource by name from dll
QHTM_MsgBox( HTML, Caption = "", Type = "", HGui = 0 )
MsgBox replacement
HTML | Text to be shown in html format |
Caption | Optional window caption |
Type | Space separated list of MessageBox types: ABORTRETRYIGNORE CANCELTRYCONTINUE COMPOSITE DEFAULT_DESKTOP_ONLY DEFBUTTON1 DEFBUTTON2 DEFBUTTON3 DEFBUTTON4 ERR_INVALID_CHARS DEFMASK FUNC HELP ICONASTERISK ICONHAND ICONEXCLAMATION ICONMASK ICONQUESTION MISCMASK MODEMASK NOFOCUS OK PRECOMPOSED OKCANCEL RETRYCANCEL RIGHT RTLREADING SETFOREGROUND SYSTEMMODAL TASKMODAL YESNO YESNOCANCEL USERICON USEGLYPHCHARS TYPEMASK TOPMOST ICONWARNING |
HGui | GUI handle (optional) |
Non-zero if it succeeds.
QHTM_MessageBox(“Do you <b>really</b> want to format drive C ?”, “Format”, “YESNOCANCEL ICONWARNING DEFBUTTON3”, hGui)
QHTM_PrintGetHTMLHeight( DC, HTML, PrintWidth, ZoomLevel = 2 )
Given a fixed width it returns the rendered height of the HTML. Used to determine how much HTML will fit on a single page or within a particular bounding width.
DC | The device context used to measure the HTML document. |
HTML | HTML document to measure |
PrintWidth | in pixels, of the area that the HTML document will be restricted to. |
ZoomLevel | The zoom level to print at. Can be between 0 and 4. |
The height of the HTML given a width.
QHTM_SetHTMLListbox( hListbox, Adjust = true )
Change a listbox so that it’s items can use HTML instead of plain text.
hListbox | Handle of the ListBox |
TRUE on success
Currently, this function shouldn’t be used as it produces side-effects on painting routine of Main Window and some other side effects. Also, in order to work ListBox must be created with one of the LBS_OWNERDRAW styles (0x10 0x20)
Add QHTM control.
QHTM_Add( Hwnd, X, Y, W, H, Text = "", Style = "", Handler = "", DllPath = "" )
Add HTML to the current document.
QHTM_AddHtml( hCtrl, HTML, bScroll = false )
Adjust control’s height to fit HTML.
QHTM_AdjustControl( hCtrl )
Resets the form
QHTM_FormReset( hCtrl, FormName )
Submits the form
QHTM_FormSubmit( hCtrl, FormName )
Set the function to call when submitting a form via POST
QHTM_FormSetSubmitCallback( hCtrl, Fun )
Get the width and height of the HTML
QHTM_GetDrawnSize( hCtrl, ByRef w, ByRef h )
Given a width determine the height of some HTML.
QHTM_GetHTMLHeight( DC, HTML, Width )
Return HTML rendered by the control
QHTM_GetHTML( hCtrl )
Force the HTML control to scroll to a named linked within a document.
QHTM_GotoLink( hCtrl, LinkName )
Initialise the QHTM module.
QHTM_Init( DllPath = "qhtm.dll" )
Load HTML into QHTM passing a valid filename.
QHTM_LoadFromFile( hCtrl, FileName )
Load HTML into QHTM from a resource
QHTM_LoadFromResource( hCtrl, Name, Resource = "" )
MsgBox replacement
QHTM_MsgBox( HTML, Caption = "", Type = "", HGui = 0 )
Create and return a print context.
QHTM_PrintCreateContext()
Destroy a valid QHTMCONTEXT.
QHTM_PrintDestroyContext( Context )
Set the HTML for the given print context.
QHTM_PrintSetText( Context, HTML )
Set the HTML for the given print context using a file.
QHTM_PrintSetTextFile( Context, FileName )
Layout the HTML, using the HDC passed, to determine the number of pages.
QHTM_PrintLayout( Context, DC, PRECT )
Print a page
QHTM_PrintPage( Context, DC, PageNum, PRECT )
Given a fixed width it returns the rendered height of the HTML.
QHTM_PrintGetHTMLHeight( DC, HTML, PrintWidth, ZoomLevel = 2 )
Render HTML onto a device context.
QHTM_RenderHTML( DC, HTML, Width )
Render HTML onto a device context and confined within a rectangle.
QHTM_RenderHTMLRect( DC, HTML, PRECT )
Change a button so that it can contain HTML as it’s text instead of plain text.
QHTM_SetHTMLButton( hButton, Adjust = false )
Change a listbox so that it’s items can use HTML instead of plain text.
QHTM_SetHTMLListbox( hListbox, Adjust = true )
Set whether or not QHTM will display scrollbars.
QHTM_ShowScrollbars( hCtrl, bShow )
Zoom the HTML in or out
QHTM_Zoom( hCtrl, Level = 2 )