Skip to main content

Past Blast

Featured Products

Stay in touch using the DEVBUSS RSS feeds.
 

News

Saddling the HTML View Control Part II / Catch Those Messages

Written by Alex Yakhnin  [author's bio]  [read 39286 times]
Edited by Derek

Download the code

Page 1  Page 2  Page 3 

Let's change frmContainer's Form_Load event as follows:

Private Sub Form_Load()

Dim hWndHTML As Long
Dim sText As String

hWndHTML = HTMLview.CreateHTMLControl(frmContainer.HWND, 20, 10, 200, 150)

sText = "<html>" & vbCrLf
sText = sText & "<head>" & vbCrLf
sText = sText & "<meta HTTP-EQUIV='CLEARTYPE'>" & vbCrLf
sText = sText & "</head>" & vbCrLf
sText = sText & "<body BGCOLOR='#FFFF99' text='#000080'> " & vbCrLf
sText = sText & "<img src='\windows\wcelogo1.gif'></a></p>" & vbCrLf
sText = sText & "<p><a href='#anchor1'>Jump to anchor</a></p>" & vbCrLf
sText = sText & "<p><a href='\windows\default.htm'>Link to the file</a></p>" & vbCrLf
sText = sText & "<p>This a regular text</p>" & vbCrLf
sText = sText & "<p><i>This a italic text</i></p>" & vbCrLf
sText = sText & "<p><b>This bold text</b></p>" & vbCrLf
sText = sText & "<p><font color='#FF0000'>This a red regular text</font></p>" & vbCrLf
sText = sText & " <p><a name='#anchor1'>This is the anchor</a></p>" & vbCrLf
sText = sText & "<form method='POST' action='test.htm' name='form1'>" & vbCrLf
sText = sText & "<p><select size='1' name='select1' id='select1'>" & vbCrLf
sText = sText & "<option value='First' selected>First</option>" & vbCrLf
sText = sText & "<option value='Second'>Second</option>" & vbCrLf
sText = sText & "<option>Third</option>" & vbCrLf
sText = sText & " </select></p>" & vbCrLf
sText = sText & " <p><input type='text1' name='txtText' value='Test' size='10'>"
sText = sText & " <p><input type='submit' value='Submit' name='B1'>" & vbCrLf
sText = sText & "</form>" & vbCrLf
sText = sText & " <p><a name='#anchor1'>This is the anchor</a></p>" & vbCrLf
sText = sText & "</body>" & vbCrLf
sText = sText & "</html>"
Call HTMLview.SetText(sText, True)
End Sub

When you execute the project, you will see that the anchor and file links will be shown in the control as well as a html form elements:

Tapping on the links at that stage will not do anything. Now let's add the MessageCE control to the project and subclass the parent of the HTML Viewer control - frmContainer. As it was described in the Background section, the HTML Viewer control will send notification messages to the its Parent.

Previous Page  Next Page