1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Private cmdGUID As New Guid(&HED016940, -17061, _
&H11CF, &HBA, &H4E, &H0, &HC0, &H4F, &HD7, &H8, &H16)
Private Enum MiscCommandTarget
ViewSource = 2
Options
Find = 1
End Enum
Private Function GetDocument() As mshtml.HTMLDocument
Try
Dim htm As mshtml.HTMLDocument = CType(CustomTabControl1.SelectedTab.Controls.Item(0), WebBrowser).Document
GetDocument = htm
Catch
Throw (New Exception("Erreur sur la page web demander" + "Control: " + Err.GetException().Message))
End Try
End Function
Public Sub ViewSource()
Dim cmdt As IOleCommandTarget
Dim o As Object
Try
cmdt = CType(GetDocument(), IOleCommandTarget)
cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.ViewSource), _
Convert.ToUInt32(SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o)
Catch
End Try
End Sub
Public Sub InternetOptions()
Dim cmdt As IOleCommandTarget
Dim o As Object
Try
cmdt = CType(GetDocument(), IOleCommandTarget)
cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.Options), _
Convert.ToUInt32(SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o)
Catch
End Try
End Sub
Public Sub Find()
Dim cmdt As IOleCommandTarget
Dim o As Object
Try
cmdt = CType(GetDocument(), IOleCommandTarget)
cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.Find), _
Convert.ToUInt32(SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o)
Catch
End Try
End Sub
Private Sub AfficherLesSourcesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AfficherLesSourcesToolStripMenuItem.Click
ViewSource()
End Sub |
Partager