I am working with VB6 WebBrowser, Here i need to open a vb6 form when user click any particular link of WebBrowser
\'s link like
In HTML
Pick a better naming scheme like:
Click To show VB6 Form2
Waffles
Then intercept link clicks via the BeforeNavigate2
event, look at the url and if it matches #vb-*
run your code:
Private Sub WebBrowserCtrl_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
'// get #vb-XXX command from url
Dim pos As Long: pos = InStrRev(URL, "#vb-")
If pos Then
Cancel = True '// stop default navigation
URL = Mid$(URL, pos + 4)
Select Case LCase$(URL)
Case "showform2": Form2.Show
'...
Case "waffles": MsgBox "Waffles."
Case Else: MsgBox "Unknown Command " & URL
End Select
End If
End Sub