Shows Chrome Developer Tools and optionally inspects an HTML element.
A HWND handle of a window or control that will parent the Dev Tools.
If zero (0), Dev Tools will open in their own window.
The X coordinate of the element to Inspect.
The Y coordinate of the element to Inspect.
Shows Chrome Developer Tools and optionally inspects an HTML element.
Visual Basic |
---|
Public Sub ShowDevTools( _ ByVal hWnd As Long, _ Optional ByVal InspectElementX As Long = 0, _ Optional ByVal InspectElementY As Long = 0 _ ) |
A HWND handle of a window or control that will parent the Dev Tools.
If zero (0), Dev Tools will open in their own window.
The X coordinate of the element to Inspect.
The Y coordinate of the element to Inspect.
This method opens built-in Chromium Dev Tools and optionally you can pass the X,Y coordinates of the HTML element you want to inspect.
=Option Explicit Private HTML_X As Long Private HTML_Y As Long Private Sub Editor_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String) With Settings .accept_language_list = "es-CL,en-GB" .cache_path = App.Path + "\MyCache\Editor" .show_context_menu = False End With End Sub Private Sub Editor_OnBrowserReady() Editor.BaseURL = BaseURL Editor.Open BaseURL + "Editor.html" End Sub Private Sub Editor_OnLoadEnd() Editor.Events = DOM_EVENT_MOUSE_DOWN End Sub Private Sub Editor_OnEvent(ByVal EventType As String, ByVal EventSelector As String, ByVal TargetSelector As String, ByVal TargetPath As String, ByVal EventData As String, ByVal Async As Boolean, PreventDefault As Boolean, CancelBubble As Boolean) Select Case EventType Case "mousedown" HTML_X = EventValue(EventData, "x") HTML_Y = EventValue(EventData, "y") If EventValue(EventData, "which") = "3" And EventValue(EventData, "shiftKey") = "true" Then ContextMenuTimer.Enabled = False ContextMenuTimer.Enabled = True End If End Select End Sub Private Sub ContextMenuTimer_Timer() ContextMenuTimer.Enabled = False PopupMenu mnuPopup End Sub Private Sub mnuShowDevTools_Click() Editor.ShowDevTools 0 End Sub Private Sub mnuInspect_Click() Editor.ShowDevTools 0, HTML_X, HTML_Y End Sub Private Function EventValue(EventData As String, ByVal Name As String) As Variant Dim p As Long Dim f As String f = Chr(34) + Name + Chr(34) + ":" p = InStr(EventData, f) If p = 0 Then Exit Function EventValue = Mid(EventData, p + Len(f)) EventValue = Left(EventValue, InStr(EventValue, vbLf) - 1) EventValue = Left(EventValue, InStr(EventValue, ",") - 1) End Function