VB6 Webbowser controls JS interact with frameless screen and right-click menu

1. Right menu screen

 Click the "Project" menu -> "reference", found in the list "Microsoft HTML Object Library" check mark, press OK on it.

     

   Then add their own controls

      

Dim WithEvents M_Dom As MSHTML.HTMLDocument  
Private Function M_Dom_oncontextmenu() As Boolean 
M_Dom_oncontextmenu = False 
End Function

Private Sub Webbrowser1_DownloadComplete() 
Set M_Dom = Webbrowser1.Document 
End Sub

 

2. No borders as well as interactive and JS

 

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

 

Set M_Dom = WebBrowser1.Document
'Me.PopupMenu mymenu

 

'The On Error Resume the Next
pDisp.Document.body.setAttribute " Extend ", Me' is used in the JS and web interaction
With WebBrowser1 ' borderless set
.Document.body.Scroll = "NO"
.Document.body.Style.border = "0px"
.Document.body.Style.margin = "0px"
.Document.body.Style.overflow = "hidden"
End With

End Sub

 

Function doSomething (ByVal sParam $) 'processing pages in the event
MsgBox sParam, vbInformation Or vbOKOnly, "doSomething"
End Function

 

VB program calls the doSomething inside page in:

<a href="void(0)" onclick="document.body.extend.doSomething('www.google.com-000000');return false;">google.com</a><br />

 

Guess you like

Origin www.cnblogs.com/wgscd/p/11008269.html