HTML Control



This documentation is preliminarily

It's a little more complicated to use that control. The control fires events to the dialog. Normally the dialog can handle the events but the AHK-dialog does not know anything of them. Therefore the control had to be changed: It sends messages to the dialog to inform it that an event has arrived. To extract the event-data you have to call ProcessHTMLMsg. This call will receive the message and saves the data in an array. You can call GetHTMLCtrlMessage to retrieve the oldest entry. If there are no more entries in the array you will retrieve 0 as return value.

Create a HTML control
HTMLStaticHWND := DllCall("AHKCtrlSupport\CreateHTMLCtrl", int, dwexStyle, int, x, int, y, int, width, int, height, DWORD, HWND, int, nID, "Cdecl Int")
HTMLStaticHWND Handle to the new control
dwexStyle unused
x, y top left coordinates on the dialog
Width, Height Width and Height of the control
HWND Handle of the dialog
ID Id of the new control



Process messages, received from the control
nRC := DllCall("AHKCtrlSupport\ProcessHTMLMsg", int, msg, int, wp, int, lp, "Cdecl Int")
nRC NULL: error
<>NULL: ok
Pass the parameters you received in an onmessage-handler to the dll. The dll will process the parameters





Set new html content
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlText", int, HTMLStaticHWND, str, EditControlText, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl
EditControlText The HTML-Code you want to be displayed



Load the contents of an URL
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlNavigate", int, HTMLStaticHWND, str, NewURL, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl
NewURL i.e.: http://www.autohotkey.com



Clear the contents and load about:blank
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlClear", int, HTMLStaticHWND, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Go Back
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlGoBack", int, HTMLStaticHWND, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Go Forward
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlGoForward", int, HTMLStaticHWND, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Refresh
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlRefresh", int, HTMLStaticHWND, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Stop whatever the control is doing
nRC := DllCall("AHKCtrlSupport\SetHTMLCtrlStop", int, HTMLStaticHWND, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Is the control busy
nRC := DllCall("AHKCtrlSupport\GetHTMLCtrlIsBusy", int, HTMLStaticHWND, "Cdecl Int")
nRC 0: control has nothing to do
1: control is busy
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Get the current URL
nRC := DllCall("AHKCtrlSupport\GetHTMLCtrlLocationURL", int, HTMLStaticHWND, int, 200, str, szURL, "Cdecl Int")
nRC NULL: error
<>NULL: ok
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl
int size Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
szURL current URL



Is the control ready or still doing something?
nRC := DllCall("AHKCtrlSupport\GetHTMLCtrlReadyState", int, HTMLStaticHWND, "Cdecl Int")
nRC 0: Uninitialized
1: Loading
2: Loaded
3: Interactive
4: Complete
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Is the control ready or still doing something?
nRC := DllCall("AHKCtrlSupport\GetHTMLCtrlReadyState", int, HTMLStaticHWND, "Cdecl Int")
nRC 0: not ready
1: ready
HTMLStaticHWND Handle to the control. You've got the handle from CreateHTMLCtrl



Get various infos from the received events
nRC := DllCall("AHKCtrlSupport\GetHTMLCtrlMessage", "int *", HWNDFrom, "int *", nID, "int *", nCode, int, 100, STR, szURL, int, 100, STR, szframe, "int *", nPosDataSize, int, 100, STR, szData, int, 100, str, szHeaders, "int *", progress, "int *", progressmax, int, 100, str, szText, "Cdecl Int")
nRC 0= no more messages in the queue
1: ok
HWNDFrom The HWND which has sent the event
nID ID of the control
nCode 0: BeforeNavigation
1: DocumentComplete
2: DownloadBegin
3: ProgressChange
4: DownloadComplete
5: NavigateComplete
6: StatusTextChange
7: TitleChange
int Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
szURL new/current URL
int Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
szframe frame-info
nPosDataSize unused
int Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
szData currently unused
int Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
szHeaders ...
int Progress (page loaded -progress- of -progress_max-)
int Progress_Max
int Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space
Status bar text ...



Example:

See the file HTML_CtrlSupport.ahk in the ZIP-file, you have to download from
AHKCtrlSupport.zip