This example demonstrates how to use the BrowserHawk ActiveX component from Visual Basic applications. In this example we have a user agent that we wish to create the BrowserHawk object for so we can check the various browser properties.
Using the BrowserHawk ActiveX component from Visual Basic:
1) First, add a reference in your project to your cyscapesvr.dll as follows:
Choose References from the Project menu
If you do not see BrowserHawk in the list of Available References, click on the Browse button and enter the full path to your cyscapesvr.dll (typically x:\winnt\system32\cyscapesvr.dll). This entry should then appear in the list.
Select the check box next to BrowserHawk in the list of Available References and then press OK.
2) Call the BrowserHawk Initialize Method to create an object based on a specific user agent. For example:
Private Sub Command1_Click()
Dim bhObj As Object
Set bhObj = CreateObject("cyScape.browserObj")
'note the use of CreateObject, not Server.CreateObject
useragent = "Mozilla/5.0 (WinNT; I)"
bhObj.Initialize useragent
End Sub
See Also: