Page 1
Page 2
Page 3
Now, let's add another Form module to
the project and change the properties as follows:
Name: HTMLview
Visible: False
BorderStyle: 0-None
This form module will be used for encapculating
all the code relating to the HTMLview control. The first step
is to create the control (insert this code into the new form):
'===========================================
Public Function CreateHTMLControl(hWndParent, iLeft As Integer,
iTop As Integer, iWidth As Integer, iHeight As Integer) As Long
Dim dwStyle As Long
Dim g_hInst As Long
g_hInst = App.hInstance
dwStyle = WS_CHILD Or WS_VISIBLE Or WS_CLIPSIBLINGS Or WS_BORDER
g_hInstHTMLCtrl = LoadLibrary("htmlview.dll")
'Initialize library
Call InitHTMLControl(g_hInst)
'Create window
g_hwndHtml = CreateWindow(0, "DISPLAYCLASS", "HTMLV",
dwStyle, iLeft, iTop, iWidth, iHeight, hWndParent, 0, g_hInst,
vbNull)
Call SetFocusAPI(g_hwndHtml)
Call PostMessage(g_hwndHtml, DTM_ENABLESHRINK, 0, True)
' We'll need this later for copy text manipulations
hWndChild = GetWindow(g_hwndHtml, GW_CHILD)
Call PostMessage(g_hwndHtml, DTM_ENABLESCRIPTING, 0, True)
CreateHTMLControl = g_hwndHtml
End Function
'===========================================
We can test this function, by using the following
code in the Form_Load event of the frmContainer
form:
'======================================
Sub Form_Load()
Dim hWndHTML as Long
hWndHTML = HTMLview.CreateHTMLControl(frmContainer.hWnd, 1, 1,
200, 200)
End Sub
'======================================
You should see the form with an instantiated
HTMLView control:

So far so good! We have created the
control and placed it on the form. How about some html text to
display in the control?
Previous Page
Next Page