Announcement

Collapse
No announcement yet.

Using CWindow to embed the WebBrowser control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using CWindow to embed the WebBrowser control

    This example demonstrates how to use the CWindow class to embed the WebBrowser control in a DDT dialog. Embedding this control has many uses, some of them demonstrated in further examples below.

    Code:
    #COMPILE EXE
    #DIM ALL
    %UNICODE = 1
    
    ' // Include files for external files
    %USEWEBBROWSER = 1            ' // Use the WebBrowser control
    #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
    
    ' // Identifier
    %IDC_WEBBROWSER = 1001
    
    ' ########################################################################################
    ' Main
    ' ########################################################################################
    FUNCTION PBMAIN
    
       ' // Create the dialog
       LOCAL hDlg AS DWORD
       DIALOG NEW PIXELS, 0, "WebBrowser", , , 600, 350, %WS_OVERLAPPEDWINDOW TO hDlg
    
       ' // Create an instance of the class
       LOCAL pWindow AS IWindow
       pWindow = CLASS "CWindow"
       IF ISNOTHING(pWindow) THEN EXIT FUNCTION
    
       ' // Add a WebBrowser control
       LOCAL bstrURL AS WSTRING
    
       ' // You can pass a URL
       bstrURL = "http://www.powerbasic.com/support/pbforums/index.php"
    
       ' // or a path to an Active document file (Excel, Word or PDF)
    '   bstrURL = EXE.Path$ & "Test.xls"              ' <-- change me!
    '   bstrURL = EXE.Path$ & "JetSQL.doc"            ' <-- change me!
    '   bstrURL = EXE.Path$ & "COMCollections.pdf"    ' <-- change me!
    
       ' // or a fragment of HTML code (remember to always start with "MSHTML:")
    '   bstrURL = "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"
    
       ' // or a web page (remember to always start with "MSHTML:")
    '   LOCAL s AS WSTRING
    '   LOCAL bstrName AS WSTRING
    
    '   S =  "MSHTML:<?xml version=""1.0""?>"
    '   s += "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">" & $CRLF
    '   s += "<html xmlns=""http://www.w3.org/1999/xhtml"">" & $CRLF
    '   s += "<head>" & $CRLF
    '   s += "<title>Image Test</title>" & $CRLF
    '   s += "</head>" & $CRLF
    '   s += "<body scroll=" & $DQ & "auto" & $DQ & " style=" & $DQ & "MARGIN: 0px 0px 0px 0px" & $DQ & " >" & $CRLF
    '   bstrName = EXE.Path$ & "Ciutat_de_les_Arts_i_de_les_Ciencies_02.jpg"
    '   s += "<img src=" & $DQ & bstrName & $DQ & " alt=" & $DQ & bstrName & $DQ & " title=" & $DQ & bstrName & $DQ & " "
    '   s += "/>" & $CRLF
    '   s += "</body>" & $CRLF
    '   s += "</html>" & $CRLF
    '   bstrURL = s
    
       ' // Create the WebBrowser control
       LOCAL nWide, nHigh AS LONG
       DIALOG GET CLIENT hDlg TO nWide, nHigh
       pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, NOTHING, 0, 0, nWide, nHigh)
    
       ' // Display and activate the dialog
       DIALOG SHOW MODAL hDlg, CALL DlgProc
    
    END FUNCTION
    ' ########################################################################################
    
    ' ========================================================================================
    ' Main Dialog procedure
    ' ========================================================================================
    CALLBACK FUNCTION DlgProc() AS LONG
    
       SELECT CASE CBMSG
    
          CASE %WM_COMMAND
             SELECT CASE CB.CTL
                ' ...
                ' ...
             END SELECT
    
          CASE %WM_SIZE
             IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                ' // Resize the control
                LOCAL nWide, nHigh AS LONG
                DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
             END IF
    
       END SELECT
    
    END FUNCTION
    ' ========================================================================================
    Forum: http://www.jose.it-berater.org/smfforum/index.php

  • #2
    WebBroser control with events

    Code:
    #COMPILE EXE
    #DIM ALL
    %UNICODE = 1
    
    ' // Include files for external files
    %USEWEBBROWSER = 1            ' // Use the WebBrowser control
    #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
    
    ' // Identifier
    %IDC_WEBBROWSER = 1001
    
    ' ########################################################################################
    ' Main
    ' ########################################################################################
    FUNCTION PBMAIN
    
       ' // Create the dialog
       LOCAL hDlg AS DWORD
       DIALOG NEW PIXELS, 0, "WebBrowser", , , 600, 350, %WS_OVERLAPPEDWINDOW TO hDlg
    
       ' // Create an instance of the class
       LOCAL pWindow AS IWindow
       pWindow = CLASS "CWindow"
       IF ISNOTHING(pWindow) THEN EXIT FUNCTION
    
       ' // Add a WebBrowser control
       LOCAL bstrURL AS WSTRING
    
       ' // You can pass a URL
       bstrURL = "http://www.powerbasic.com/support/pbforums/index.php"
    
       ' // Create an instance of the event class
       LOCAL pWBEvents AS DWebBrowserEvents2Impl
       pWBEvents = CLASS "CDWebBrowserEvents2"
    
       ' // Create the WebBrowser control
       LOCAL nWide, nHigh AS LONG
       DIALOG GET CLIENT hDlg TO nWide, nHigh
       pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, pWBEvents, 0, 0, nWide, nHigh)
       CONTROL SET FOCUS hDlg, %IDC_WEBBROWSER
    
       ' // Display and activate the dialog
       DIALOG SHOW MODAL hDlg, CALL DlgProc
    
    END FUNCTION
    ' ########################################################################################
    
    ' ========================================================================================
    ' Main Dialog procedure
    ' ========================================================================================
    CALLBACK FUNCTION DlgProc() AS LONG
    
       SELECT CASE CBMSG
    
          CASE %WM_COMMAND
             SELECT CASE CB.CTL
                ' ...
                ' ...
             END SELECT
    
          CASE %WM_SIZE
             IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                ' // Resize the control
                LOCAL nWide, nHigh AS LONG
                DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
             END IF
    
       END SELECT
    
    END FUNCTION
    ' ========================================================================================
    
    
    ' ########################################################################################
    ' Class CDWebBrowserEvents2
    ' Interface name = DWebBrowserEvents2
    ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
    ' Web Browser Control events interface
    ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
    ' ########################################################################################
    
    CLASS CDWebBrowserEvents2 GUID$("{700B73A2-CCFC-4FE0-B9AC-D5853D71B7B9}") AS EVENT
    
    INTERFACE DWebBrowserEvents2Impl GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}") AS EVENT
    
       INHERIT IDispatch
    
       ' =====================================================================================
       METHOD StatusTextChange <102> ( _
         BYVAL strText AS STRING _                          ' __in BSTR Text
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD ProgressChange <108> ( _
         BYVAL Progress AS LONG _                           ' __in long Progress
       , BYVAL ProgressMax AS LONG _                        ' __in long ProgressMax
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD CommandStateChange <105> ( _
         BYVAL nCommand AS LONG _                           ' __in long Command
       , BYVAL bEnable AS INTEGER _                         ' __in VARIANT_BOOL Enable
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD DownloadBegin <106>
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD DownloadComplete <104>
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD TitleChange <113> ( _
         BYVAL strText AS STRING _                          ' __in BSTR Text
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD PropertyChange <112> ( _
         BYVAL strProperty AS STRING _                      ' __in BSTR szProperty
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD BeforeNavigate2 <250> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       , BYREF vFlags AS VARIANT _                          ' __in VARIANT* Flags
       , BYREF vTargetFrameName AS VARIANT _                ' __in VARIANT* TargetFrameName
       , BYREF vPostData AS VARIANT _                       ' __in VARIANT* PostData
       , BYREF vHeaders AS VARIANT _                        ' __in VARIANT* Headers
       , BYREF Cancel AS INTEGER _                          ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD NewWindow2 <251> ( _
         BYREF ppDisp AS IDispatch _                        ' __in_out IDispatch** ppDisp
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD NavigateComplete2 <252> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD DocumentComplete <259> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnQuit <253>
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnVisible <254> ( _
         BYVAL bVisible AS INTEGER _                        ' __in VARIANT_BOOL Visible
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnToolBar <255> ( _
         BYVAL bToolBar AS INTEGER _                        ' __in VARIANT_BOOL ToolBar
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnMenuBar <256> ( _
         BYVAL bMenuBar AS INTEGER _                        ' __in VARIANT_BOOL MenuBar
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnStatusBar <257> ( _
         BYVAL bStatusBar AS INTEGER _                      ' __in VARIANT_BOOL StatusBar
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnFullScreen <258> ( _
         BYVAL bFullScreen AS INTEGER _                     ' __in VARIANT_BOOL FullScreen
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD OnTheaterMode <260> ( _
         BYVAL bTheaterMode AS INTEGER _                    ' __in VARIANT_BOOL TheaterMode
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowSetResizable <262> ( _
         BYVAL bResizable AS INTEGER _                      ' __in VARIANT_BOOL Resizable
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowSetLeft <264> ( _
         BYVAL nLeft AS LONG _                              ' __in long Left
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowSetTop <265> ( _
         BYVAL Top AS LONG _                                ' __in long Top
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowSetWidth <266> ( _
         BYVAL nWidth AS LONG _                             ' __in long Width
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowSetHeight <267> ( _
         BYVAL Height AS LONG _                             ' __in long Height
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowClosing <263> ( _
         BYVAL IsChildWindow AS INTEGER _                   ' __in     VARIANT_BOOL IsChildWindow
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD ClientToHostWindow <268> ( _
         BYREF CX AS LONG _                                 ' __in_out long* CX
       , BYREF CY AS LONG _                                 ' __in_out long* CY
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD SetSecureLockIcon <269> ( _
         BYVAL SecureLockIcon AS LONG _                     ' __in long SecureLockIcon
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD FileDownload <270> ( _
         BYVAL bActiveDocument AS INTEGER _                 ' __in     VARIANT_BOOL ActiveDocument
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD NavigateError <271> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       , BYREF vFrame AS VARIANT _                          ' __in VARIANT* Frame
       , BYREF vStatusCode AS VARIANT _                     ' __in VARIANT* StatusCode
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD PrintTemplateInstantiation <225> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD PrintTemplateTeardown <226> ( _
         BYVAL pDisp AS IDispatch _                         ' __in pDisp /* VT_DISPATCH <IDispatch> */
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD UpdatePageStatus <227> ( _
         BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
       , BYREF nPage AS VARIANT _                           ' __in VARIANT* nPage
       , BYREF fDone AS VARIANT _                           ' __in VARIANT* fDone
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD PrivacyImpactedStateChange <272> ( _
         BYVAL bImpacted AS INTEGER _                       ' __in VARIANT_BOOL bImpacted
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD NewWindow3 <273> ( _
         BYREF ppDisp AS IDispatch _                        ' __in_out IDispatch** ppDisp
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       , BYVAL dwFlags AS DWORD _                           ' __in unsigned long dwFlags
       , BYVAL bstrUrlContext AS STRING _                   ' __in BSTR bstrUrlContext
       , BYVAL bstrUrl AS STRING _                          ' __in BSTR bstrUrl
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD SetPhishingFilterStatus <282> ( _
         BYVAL PhishingFilterStatus AS LONG _               ' __in long PhishingFilterStatus
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD WindowStateChanged <283> ( _
         BYVAL dwWindowStateFlags AS DWORD _                ' __in unsigned long dwWindowStateFlags
       , BYVAL dwValidFlagsMask AS DWORD _                  ' __in unsigned long dwValidFlagsMask
       )                                                    ' void
    
         ' *** Insert your code here ***
         OutputDebugString FUNCNAME$
    
       END METHOD
       ' =====================================================================================
    
    END INTERFACE
    
    END CLASS
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      WebBrowser control customized

      Code:
      #COMPILE EXE
      #DIM ALL
      %UNICODE = 1
      
      ' // Include files for external files
      %USEWEBBROWSER = 1            ' // Use the WebBrowser control
      #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
      
      ' // Identifier
      %IDC_WEBBROWSER = 1001
      
      ' ########################################################################################
      ' Main
      ' ########################################################################################
      FUNCTION PBMAIN
      
         ' // Create the dialog
         LOCAL hDlg AS DWORD
         DIALOG NEW PIXELS, 0, "WebBrowser", , , 600, 350, %WS_OVERLAPPEDWINDOW TO hDlg
      
         ' // Create an instance of the class
         LOCAL pWindow AS IWindow
         pWindow = CLASS "CWindow"
         IF ISNOTHING(pWindow) THEN EXIT FUNCTION
      
         ' // Add a WebBrowser control
         LOCAL bstrURL AS WSTRING
      
         ' // You can pass a URL
         bstrURL = "http://www.powerbasic.com/support/pbforums/index.php"
      
         ' // Create an instance of the event class
         LOCAL pWBEvents AS DWebBrowserEvents2Impl
         pWBEvents = CLASS "CDWebBrowserEvents2"
      
         ' // Create the WebBrowser control
         LOCAL nWide, nHigh AS LONG
         DIALOG GET CLIENT hDlg TO nWide, nHigh
         pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, pWBEvents, 0, 0, nWide, nHigh)
         CONTROL SET FOCUS hDlg, %IDC_WEBBROWSER
      
         ' // Display and activate the dialog
         DIALOG SHOW MODAL hDlg, CALL DlgProc
      
      END FUNCTION
      ' ########################################################################################
      
      ' ========================================================================================
      ' Main Dialog procedure
      ' ========================================================================================
      CALLBACK FUNCTION DlgProc() AS LONG
      
         SELECT CASE CBMSG
      
            CASE %WM_COMMAND
               SELECT CASE CB.CTL
                  ' ...
                  ' ...
               END SELECT
      
            CASE %WM_SIZE
               IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                  ' // Resize the control
                  LOCAL nWide, nHigh AS LONG
                  DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                  CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
               END IF
      
         END SELECT
      
      END FUNCTION
      ' ========================================================================================
      
      
      ' ########################################################################################
      ' Class CDWebBrowserEvents2
      ' Interface name = DWebBrowserEvents2
      ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
      ' Web Browser Control events interface
      ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
      ' ########################################################################################
      
      CLASS CDWebBrowserEvents2 GUID$("{700B73A2-CCFC-4FE0-B9AC-D5853D71B7B9}") AS EVENT
      
      INTERFACE DWebBrowserEvents2Impl GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}") AS EVENT
      
         INHERIT IDispatch
      
         ' =====================================================================================
         ' Fires when the status bar text of the object has changed.
         ' =====================================================================================
         METHOD StatusTextChange <102> ( _
           BYVAL strText AS STRING _                          ' __in BSTR Text
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the progress of a download operation is updated on the object.
         ' =====================================================================================
         METHOD ProgressChange <108> ( _
           BYVAL Progress AS LONG _                           ' __in long Progress
         , BYVAL ProgressMax AS LONG _                        ' __in long ProgressMax
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the enabled state of a command changes.
         ' =====================================================================================
         METHOD CommandStateChange <105> ( _
           BYVAL nCommand AS LONG _                           ' __in long Command
         , BYVAL bEnable AS INTEGER _                         ' __in VARIANT_BOOL Enable
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a navigation operation begins.
         ' =====================================================================================
         METHOD DownloadBegin <106>
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a navigation operation finishes, is halted, or fails.
         ' =====================================================================================
         METHOD DownloadComplete <104>
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the title of a document in the object becomes available or changes.
         ' =====================================================================================
         METHOD TitleChange <113> ( _
           BYVAL strText AS STRING _                          ' __in BSTR Text
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::PutProperty method of the object changes the value of a property.
         ' =====================================================================================
         METHOD PropertyChange <112> ( _
           BYVAL strProperty AS STRING _                      ' __in BSTR szProperty
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires before navigation occurs in the given object (on either a window element or a frameset element).
         ' =====================================================================================
         METHOD BeforeNavigate2 <250> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
         , BYREF vFlags AS VARIANT _                          ' __in VARIANT* Flags
         , BYREF vTargetFrameName AS VARIANT _                ' __in VARIANT* TargetFrameName
         , BYREF vPostData AS VARIANT _                       ' __in VARIANT* PostData
         , BYREF vHeaders AS VARIANT _                        ' __in VARIANT* Headers
         , BYREF Cancel AS INTEGER _                          ' __in_out VARIANT_BOOL* Cancel
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a new window is to be created.
         ' =====================================================================================
         METHOD NewWindow2 <251> ( _
           BYREF ppDisp AS IDispatch _                        ' __in_out IDispatch** ppDisp
         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires after a navigation to a link is completed on a window element or a frameSet element.
         ' =====================================================================================
         METHOD NavigateComplete2 <252> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a document is completely loaded and initialized.
         ' =====================================================================================
         METHOD DocumentComplete <259> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ' // After the MSHTML document has been loaded we retrieve a reference to its
            ' // ICustomDoc interface and give him a pointer to our IDocHostUIHandler interface
            ' // to allow for customization.
      
            LOCAL pIWebBrowser2 AS IWebBrowser2
            LOCAL pIHTMLDocument2 AS IHTMLDocument2
            LOCAL pICustomDoc AS ICustomDoc
            LOCAL pDocHostUIHandler AS IDocHostUIHandler2Impl
      
            pIWebBrowser2 = pDisp
            IF ISNOTHING(pIWebBrowser2) THEN EXIT METHOD
      
            ' // Get a reference to the active document
            pIHTMLDocument2 = pIWebBrowser2.Document
            IF ISNOTHING(pIHTMLDocument2) THEN EXIT METHOD
      
            ' // Get a reference to the CustomDoc interface
            pICustomDoc = pIHTMLDocument2
            IF ISNOTHING(pICustomDoc) THEN EXIT METHOD
      
            ' // Set our IDocHostUIHandler interface for MSHTML
            ' // MSHTML will release its previous IDocHostUIHandler interface
            ' // (if one is present) and call pDocHostUIHandler's AddRef method.
            pDocHostUIHandler = CLASS "CDocHostUIHandler2"
            IF ISOBJECT(pDocHostUIHandler) THEN
               pICustomDoc.SetUIHandler(pDocHostUIHandler)
            END IF
      
            ' Release the interfaces
            pDocHostUIHandler = NOTHING
            pICustomDoc = NOTHING
            pIWebBrowser2 = NOTHING
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires before the Internet Explorer application quits.
         ' =====================================================================================
         METHOD OnQuit <253>
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::Visible property of the object is changed.
         ' =====================================================================================
         METHOD OnVisible <254> ( _
           BYVAL bVisible AS INTEGER _                        ' __in VARIANT_BOOL Visible
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::ToolBar property is changed.
         ' =====================================================================================
         METHOD OnToolBar <255> ( _
           BYVAL bToolBar AS INTEGER _                        ' __in VARIANT_BOOL ToolBar
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::MenuBar property is changed.
         ' =====================================================================================
         METHOD OnMenuBar <256> ( _
           BYVAL bMenuBar AS INTEGER _                        ' __in VARIANT_BOOL MenuBar
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::StatusBar property is changed.
         ' =====================================================================================
         METHOD OnStatusBar <257> ( _
           BYVAL bStatusBar AS INTEGER _                      ' __in VARIANT_BOOL StatusBar
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::FullScreen property is changed.
         ' =====================================================================================
         METHOD OnFullScreen <258> ( _
           BYVAL bFullScreen AS INTEGER _                     ' __in VARIANT_BOOL FullScreen
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the IWebBrowser2::TheaterMode property is changed.
         ' =====================================================================================
         METHOD OnTheaterMode <260> ( _
           BYVAL bTheaterMode AS INTEGER _                    ' __in VARIANT_BOOL TheaterMode
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires to indicate whether the host window should allow resizing of the object.
         ' =====================================================================================
         METHOD WindowSetResizable <262> ( _
           BYVAL bResizable AS INTEGER _                      ' __in VARIANT_BOOL Resizable
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the object changes its left position.
         ' =====================================================================================
         METHOD WindowSetLeft <264> ( _
           BYVAL nLeft AS LONG _                              ' __in long Left
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the object changes its top position.
         ' =====================================================================================
         METHOD WindowSetTop <265> ( _
           BYVAL Top AS LONG _                                ' __in long Top
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the object changes its width.
         ' =====================================================================================
         METHOD WindowSetWidth <266> ( _
           BYVAL nWidth AS LONG _                             ' __in long Width
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the object changes its height.
         ' =====================================================================================
         METHOD WindowSetHeight <267> ( _
           BYVAL Height AS LONG _                             ' __in long Height
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the window of the object is about to be closed by script.
         ' =====================================================================================
         METHOD WindowClosing <263> ( _
           BYVAL IsChildWindow AS INTEGER _                   ' __in     VARIANT_BOOL IsChildWindow
         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires to request that the client window size is converted to the host window size.
         ' =====================================================================================
         METHOD ClientToHostWindow <268> ( _
           BYREF CX AS LONG _                                 ' __in_out long* CX
         , BYREF CY AS LONG _                                 ' __in_out long* CY
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when there is a change in encryption level.
         ' =====================================================================================
         METHOD SetSecureLockIcon <269> ( _
           BYVAL SecureLockIcon AS LONG _                     ' __in long SecureLockIcon
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires to indicate that a file download is about to occur. If a file download dialog
         ' box can be displayed, this event fires prior to the appearance of the dialog box.
         ' =====================================================================================
         METHOD FileDownload <270> ( _
           BYVAL bActiveDocument AS INTEGER _                 ' __in     VARIANT_BOOL ActiveDocument
         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when an error occurs during navigation.
         ' =====================================================================================
         METHOD NavigateError <271> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
         , BYREF vFrame AS VARIANT _                          ' __in VARIANT* Frame
         , BYREF vStatusCode AS VARIANT _                     ' __in VARIANT* StatusCode
         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a print template is instantiated.
         ' =====================================================================================
         METHOD PrintTemplateInstantiation <225> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when a print template is destroyed.
         ' =====================================================================================
         METHOD PrintTemplateTeardown <226> ( _
           BYVAL pDisp AS IDispatch _                         ' __in pDisp /* VT_DISPATCH <IDispatch> */
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Not implemented.
         ' =====================================================================================
         METHOD UpdatePageStatus <227> ( _
           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
         , BYREF nPage AS VARIANT _                           ' __in VARIANT* nPage
         , BYREF fDone AS VARIANT _                           ' __in VARIANT* fDone
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fired when an event occurs that impacts privacy, or when a user navigates away from a
         ' URL that has impacted privacy.
         ' =====================================================================================
         METHOD PrivacyImpactedStateChange <272> ( _
           BYVAL bImpacted AS INTEGER _                       ' __in VARIANT_BOOL bImpacted
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Raised when a new window is to be created. Extends DWebBrowserEvents2::NewWindow2
         ' with additional information about the new window.
         ' =====================================================================================
         METHOD NewWindow3 <273> ( _
           BYREF ppDisp AS IDispatch _                        ' __in_out IDispatch** ppDisp
         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
         , BYVAL dwFlags AS DWORD _                           ' __in unsigned long dwFlags
         , BYVAL bstrUrlContext AS STRING _                   ' __in BSTR bstrUrlContext
         , BYVAL bstrUrl AS STRING _                          ' __in BSTR bstrUrl
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires to indicate the progress and status of Microsoft Phishing Filter analysis of
         ' the current webpage.
         ' =====================================================================================
         METHOD SetPhishingFilterStatus <282> ( _
           BYVAL PhishingFilterStatus AS LONG _               ' __in long PhishingFilterStatus
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Fires when the visibility state of a content window, such as the browser window or a tab, changes.
         ' =====================================================================================
         METHOD WindowStateChanged <283> ( _
           BYVAL dwWindowStateFlags AS DWORD _                ' __in unsigned long dwWindowStateFlags
         , BYVAL dwValidFlagsMask AS DWORD _                  ' __in unsigned long dwValidFlagsMask
         )                                                    ' void
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
      END INTERFACE
      
      END CLASS
      ' ========================================================================================
      
      ' ########################################################################################
      ' Class CDocHostUIHandler2
      ' Implementation of the IDocHostUIHandler2 interface
      ' ########################################################################################
      
      ' ========================================================================================
      ' Class CDocHostUIHandler2
      ' ========================================================================================
      $IID_CDocHostUIHandler2 = GUID$("{DFD6CC82-CC58-4227-AC23-A4B36E7A45B1}")
      
      CLASS CDocHostUIHandler2 $IID_CDocHostUIHandler2 AS COMMON   ' // Use AS COMMON to avoid removal of methods
      
      INTERFACE IDocHostUIHandler2Impl $IID_IDocHostUIHandler2
      
         INHERIT IUnknown
      
         ' =====================================================================================
         ' Enables MSHTML to display a shortcut menu.
         ' =====================================================================================
         METHOD ShowContextMenu ( _                           ' VTable offset = 12
           BYVAL dwID AS DWORD _                              ' /* [in] */ DWORD dwID
         , BYREF ppt AS POINT _                               ' /* [in] */ POINT *ppt
         , BYVAL pcmdtReserved AS IUnknown _                  ' /* [in] */ IUnknown *pcmdtReserved
         , BYVAL pdispReserved AS IDispatch _                 ' /* [in] */ IDispatch *pdispReserved
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ' // This event notifies that the user has clicked the right mouse button to show the
            ' // context menu. We can anulate it returning %S_OK and show our context menu.
      
            ' // Do not allow to show the context menu
            MSGBOX "Sorry! Context menu disabled"
            METHOD = %S_OK
      
            ' // Host did not display its UI. MSHTML will display its UI.
      '      METHOD = %S_FALSE
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Gets the UI capabilities of the application that is hosting MSHTML.
         ' DOCHOSTUIFLAG_DIALOG
         '     MSHTML does not enable selection of the text in the form.
         ' DOCHOSTUIFLAG_DISABLE_HELP_MENU
         '     MSHTML does not add the Help menu item to the container's menu.
         ' DOCHOSTUIFLAG_NO3DBORDER
         '     MSHTML does not use 3-D borders on any frames or framesets. To turn the border off
         '     on only the outer frameset use DOCHOSTUIFLAG_NO3DOUTERBORDER
         ' DOCHOSTUIFLAG_SCROLL_NO
         '     MSHTML does not have scroll bars.
         ' DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
         '     MSHTML does not execute any script until fully activated. This flag is used to
         '     postpone script execution until the host is active and, therefore, ready for script
         '     to be executed.
         ' DOCHOSTUIFLAG_OPENNEWWIN
         '     MSHTML opens a site in a new window when a link is clicked rather than browse to
         '     the new site using the same browser window.
         ' DOCHOSTUIFLAG_DISABLE_OFFSCREEN
         '     Not implemented.
         ' DOCHOSTUIFLAG_FLAT_SCROLLBAR
         '     MSHTML uses flat scroll bars for any UI it displays.
         ' DOCHOSTUIFLAG_DIV_BLOCKDEFAULT
         '     MSHTML inserts the div tag if a return is entered in edit mode. Without this flag,
         '     MSHTML will use the p tag.
         ' DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
         '     MSHTML only becomes UI active if the mouse is clicked in the client area of the
         '     window. It does not become UI active if the mouse is clicked on a non-client area,
         '     such as a scroll bar.
         ' DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY
         '     MSHTML consults the host before retrieving a behavior from the URL specified on
         '     the page. If the host does not support the behavior, MSHTML does not proceed to
         '     query other hosts or instantiate the behavior itself, even for behaviors developed
         '     in script (HTML Components (HTCs)).
         ' DOCHOSTUIFLAG_CODEPAGELINKEDFONTS
         '     Microsoft Internet Explorer 5 and later. Provides font selection compatibility
         '     for Microsoft Outlook Express. If the flag is enabled, the displayed characters
         '     are inspected to determine whether the current font supports the code page. If
         '     disabled, the current font is used, even if it does not contain a glyph for the
         '     character. This flag assumes that the user is using Internet Explorer 5 and
         '     Outlook Express 4.0.
         ' DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8
         '     Internet Explorer 5 and later. Controls how nonnative URLs are transmitted over
         '     the Internet. Nonnative refers to characters outside the multibyte encoding of
         '     the URL. If this flag is set, the URL is not submitted to the server in UTF-8 encoding.
         ' DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8
         '     Internet Explorer 5 and later. Controls how nonnative URLs are transmitted over
         '     the Internet. Nonnative refers to characters outside the multibyte encoding of
         '     the URL. If this flag is set, the URL is submitted to the server in UTF-8 encoding.
         ' DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE
         '     Internet Explorer 5 and later. Enables the AutoComplete feature for forms in the
         '     hosted browser. The Intelliforms feature is only turned on if the user has
         '     previously enabled it. If the user has turned the AutoComplete feature off for
         '     forms, it is off whether this flag is specified or not.
         ' DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
         '     Internet Explorer 5 and later. Enables the host to specify that navigation should
         '     happen in place. This means that applications hosting MSHTML directly can specify
         '     that navigation happen in the application's window. For instance, if this flag is
         '     set, you can click a link in HTML mail and navigate in the mail instead of opening
         '     a new Windows Internet Explorer window.
         ' DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
         '     Internet Explorer 5 and later. During initialization, the host can set this flag
         '     to enable Input Method Editor (IME) reconversion, allowing computer users to employ
         '     IME reconversion while browsing Web pages. An input method editor is a program that
         '     allows users to enter complex characters and symbols, such as Japanese Kanji
         '     characters, using a standard keyboard. For more information, see the International
         '     Features reference in the Base Services section of the Windows Software Development
         '     Kit (SDK).
         ' DOCHOSTUIFLAG_THEME
         '     Internet Explorer 6 and later. Specifies that the hosted browser should use themes
         '     for pages it displays.
         ' DOCHOSTUIFLAG_NOTHEME
         '     Internet Explorer 6 and later. Specifies that the hosted browser should not use
         '     themes for pages it displays.
         ' DOCHOSTUIFLAG_NOPICS
         '     Internet Explorer 6 and later. Disables PICS ratings for the hosted browser.
         ' DOCHOSTUIFLAG_NO3DOUTERBORDER
         '     Internet Explorer 6 and later. Turns off any 3-D border on the outermost frame or
         '     frameset only. To turn borders off on all frame sets, use DOCHOSTUIFLAG_NO3DBORDER
         ' DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP
         '     Internet Explorer 6 and later. Disables the automatic correction of namespaces when
         '     editing HTML elements.
         ' DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK
         '     Internet Explorer 6 and later. Prevents Web sites in the Internet zone from accessing
         '     files in the Local Machine zone.
         ' DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL
         '     Internet Explorer 6 and later. Turns off untrusted protocols. Untrusted protocols
         '     include ms-its, ms-itss, its, and mk:@msitstore.
         ' DOCHOSTUIFLAG_HOST_NAVIGATES
         '     Internet Explorer 7. Indicates that navigation is delegated to the host; otherwise,
         '     MSHTML will perform navigation. This flag is used primarily for non-HTML document types.
         ' DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION
         '     Internet Explorer 7. Causes MSHTML to fire an additional DWebBrowserEvents2::BeforeNavigate2
         '     event when redirect navigations occur. Applications hosting the WebBrowser Control
         '     can choose to cancel or continue the redirect by returning an appropriate value in
         '     the Cancel parameter of the event.
         ' DOCHOSTUIFLAG_USE_WINDOWLESS_SELECTCONTROL
         '     Internet Explorer 7. Causes MSHTML to use the Document Object Model (DOM) to create
         '     native "windowless" select controls that can be visually layered under other elements.
         ' DOCHOSTUIFLAG_USE_WINDOWED_SELECTCONTROL
         '     Internet Explorer 7. Causes MSHTML to create standard Microsoft Win32 "windowed"
         '     select and drop-down controls.
         ' DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE
         '     Internet Explorer 6 for Windows XP Service Pack 2 (SP2) and later. Requires user
         '     activation for Microsoft ActiveX controls and Java Applets embedded within a web page.
         '     This flag enables interactive control blocking, which provisionally disallows direct
         '     interaction with ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements.
         '     When a control is inactive, it does not respond to user input; however, it can perform
         '     operations that do not involve interaction.
         ' DOCHOSTUIFLAG_DPI_AWARE
         '     Internet Explorer 8. Causes layout engine to calculate document pixels as 96 dots
         '     per inch (dpi). Normally, a document pixel is the same size as a screen pixel. This
         '     flag is equivalent to setting the FEATURE_96DPI_PIXEL feature control key on a
         '     per-host basis.
         ' Remarks
         '     The DOCHOSTUIFLAG_BROWSER flag, a supplementary defined constant (not technically
         '     a part of this enumeration), combines the values of DOCHOSTUIFLAG_DISABLE_HELP_MENU
         '     and DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE.
         ' =====================================================================================
         METHOD GetHostInfo ( _                               ' VTable offset = 16
           BYREF pInfo AS DOCHOSTUIINFO _                     ' /* [out][in] */ DOCHOSTUIINFO *pInfo
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            IF VARPTR(pInfo) THEN
               pInfo.cbSize = SIZEOF(DOCHOSTUIINFO)
               pInfo.dwFlags = %DOCHOSTUIFLAG_NO3DBORDER OR %DOCHOSTUIFLAG_THEME
               pInfo.dwDoubleClick = %DOCHOSTUIDBLCLK_DEFAULT
               pInfo.pchHostCss = %NULL
               pInfo.pchHostNS = %NULL
            END IF
            METHOD = %S_OK
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Enables the host to replace MSHTML menus and toolbars.
         ' =====================================================================================
         METHOD ShowUI ( _                                    ' VTable offset = 20
           BYVAL dwID AS DWORD _                              ' /* [in] */ DWORD dwID
         , BYVAL pActiveObject AS IOleInPlaceActiveObject _   ' /* [in] */ IOleInPlaceActiveObject *pActiveObject
         , BYVAL pCommandTarget AS IOleCommandTarget _        ' /* [in] */ IOleCommandTarget *pCommandTarget
         , BYVAL pFrame AS IOleInPlaceFrame _                 ' /* [in] */ IOleInPlaceFrame *pFrame
         , BYVAL pDoc AS IOleInPlaceUIWindow _                ' /* [in] */ IOleInPlaceUIWindow *pDoc
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Enables the host to remove its menus and toolbars.
         ' =====================================================================================
         METHOD HideUI ( _                                    ' VTable offset = 24
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Notifies the host that the command state has changed.
         ' =====================================================================================
         METHOD UpdateUI ( _                                  ' VTable offset = 28
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Called by the MSHTML implementation of IOleInPlaceActiveObject::EnableModeless.
         ' Also called when MSHTML displays a modal UI.
         ' =====================================================================================
         METHOD EnableModeless ( _                            ' VTable offset = 32
           BYVAL fEnable AS LONG _                            ' /* [in] */ BOOL fEnable
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Called by the MSHTML implementation of IOleInPlaceActiveObject::OnDocWindowActivate.
         ' =====================================================================================
         METHOD OnDocWindowActivate ( _                       ' VTable offset = 36
           BYVAL fActivate AS LONG _                          ' /* [in] */ BOOL fActivate
         )
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Called by the MSHTML implementation of IOleInPlaceActiveObject::OnFrameWindowActivate.
         ' =====================================================================================
         METHOD OnFrameWindowActivate ( _                     ' VTable offset = 40
           BYVAL fActivate AS LONG _                          ' /* [in] */ BOOL fActivate
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Called by the MSHTML implementation of IOleInPlaceActiveObject::ResizeBorder.
         ' =====================================================================================
         METHOD ResizeBorder ( _                              ' VTable offset = 44
           BYREF prcBorder AS RECT _                          ' /* [in] */ LPCRECT prcBorder
         , BYVAL pUIWindow AS IOleInPlaceUIWindow _           ' /* [in] */ IOleInPlaceUIWindow *pUIWindow
         , BYVAL fRameWindow AS LONG _                        ' /* [in] */ BOOL fRameWindow
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Called by MSHTML when IOleInPlaceActiveObject::TranslateAccelerator or
         ' IOleControlSite::TranslateAccelerator is called.
         ' =====================================================================================
         METHOD TranslateAccelerator ( _                      ' VTable offset = 48
           BYREF lpMsg AS tagMSG _                            ' /* [in] */ LPMSG lpMsg
         , BYREF pguidCmdGroup AS GUID _                      ' /* [in] */ const GUID *pguidCmdGroup
         , BYVAL nCmdID AS DWORD _                            ' /* [in] */ DWORD nCmdID
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ' // When you use accelerator keys such as TAB, you may need to override the
            ' // default host behavior. The example shows how to do this.
      '      IF lpMsg.message = %WM_KEYDOWN AND lpMsg.wParam = %VK_TAB THEN
      '         METHOD = %S_FALSE
      '      END IF
      
            ' // Return S_FALSE if you don't process the message
            METHOD = %S_FALSE
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Gets a registry subkey path that overrides the default Windows Internet Explorer
         ' registry settings.
         ' =====================================================================================
         METHOD GetOptionKeyPath ( _                          ' VTable offset = 52
           BYREF pchKey AS DWORD _                            ' /* [out] */ LPOLESTR *pchKey
         , BYVAL dw_ AS DWORD _                               ' /* [in] */ DWORD dw
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            pchKey = %NULL
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Enables the host to supply an alternative IDropTarget interface.
         ' =====================================================================================
         METHOD GetDropTarget ( _                             ' VTable offset = 56
           BYVAL pDropTarget AS IDropTarget _                 ' /* [in] */ IDropTarget *pDropTarget
         , BYREF ppDropTarget AS IDropTarget  _               ' /* [out] */ IDropTarget **ppDropTarget
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ppDropTarget = NOTHING
            METHOD = %E_NOTIMPL
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Gets the host's IDispatch interface.
         ' =====================================================================================
         METHOD GetExternal ( _                             ' VTable offset = 60
           BYREF ppDispatch AS IDispatch  _                 ' /* [out] */ IDispatch **ppDispatch
           ) AS LONG                                        ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ppDispatch = NOTHING
            METHOD = %S_FALSE
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Enables the host to modify the URL to be loaded.
         ' =====================================================================================
         METHOD TranslateUrl ( _                              ' VTable offset = 64
           BYVAL dwTranslate AS DWORD  _                      ' /* [in] */ DWORD dwTranslate
         , BYREF pchURLIn AS WSTRINGZ _                       ' /* [in] */ OLECHAR *pchURLIn
         , BYREF ppchURLOut AS WSTRINGZ _                     ' /* [out] */ OLECHAR **ppchURLOut
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ppchURLOut = ""
            METHOD = %S_FALSE
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Enables the host to replace the MSHTML data object.
         ' =====================================================================================
         METHOD FilterDataObject ( _                          ' VTable offset = 68
           BYVAL pDO AS IDataObject  _                        ' /* [in] */ IDataObject *pDO
         , BYREF ppDORet AS IDataObject _                     ' /* [out] */ IDataObject **ppDORet
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            ppDORet = NOTHING
            METHOD = %S_FALSE
      
         END METHOD
         ' =====================================================================================
      
         ' =====================================================================================
         ' Gets a registry subkey path that modifies Windows Internet Explorer user preferences.
         ' =====================================================================================
         METHOD GetOverrideKeyPath ( _                        ' VTable offset = 72
           BYREF pchKey AS DWORD _                            ' /* [out] */ LPOLESTR *pchKey
         , BYVAL dw_ AS DWORD _                               ' /* [in] */ DWORD dw
         ) AS LONG                                            ' HRESULT
      
           ' *** Insert your code here ***
           OutputDebugString FUNCNAME$
      
            pchKey = %NULL
      
         END METHOD
         ' =====================================================================================
      
      END INTERFACE     ' IDocHostUIHandler2Impl
      
      END CLASS         ' CDocHostUIHandler2
      ' ========================================================================================
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Google Map

        Code:
        #COMPILE EXE
        #DIM ALL
        %UNICODE = 1
        
        ' // Include files for external files
        %USEWEBBROWSER = 1            ' // Use the WebBrowser control
        #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
        
        ' // Identifier
        %IDC_WEBBROWSER = 1001
        
        ' ########################################################################################
        ' Main
        ' ########################################################################################
        FUNCTION PBMAIN
        
           ' // Create the dialog
           LOCAL hDlg AS DWORD
           DIALOG NEW PIXELS, 0, "Google Map", , , 700, 400, %WS_OVERLAPPEDWINDOW TO hDlg
        
           ' // Create an instance of the class
           LOCAL pWindow AS IWindow
           pWindow = CLASS "CWindow"
           IF ISNOTHING(pWindow) THEN EXIT FUNCTION
        
           ' // Build the html script
           LOCAL s AS WSTRING
           LOCAL cx, cy AS DOUBLE
           LOCAL zoom AS LONG
           cx = 39.47#
           cy = 0.28#
           zoom = 7
        
           s  = "<!DOCTYPE html>"
           s += "<html>"
           s += "<head>"
           s += "<meta name='viewport' content='initial-scale=1.0, user-scalable=no' />"
           s += "<style type='text/css'>" & $CRLF
           s += "html { height: 100% }" & $CRLF
           s += "  body { height: 100%; margin: 0px; padding: 0px }" & $CRLF
           s += "  #map_canvas { height: 100% }" & $CRLF
           s += "</style>" & $CRLF
           s += "<script type='text/javascript'" & $CRLF
           s += "    src='http://maps.google.com/maps/api/js?sensor=false'>" & $CRLF
           s += "</script>" & $CRLF
           s += "<script type='text/javascript'>" & $CRLF
           s += "  function initialize() {" & $CRLF
           s += "    var latlng = new google.maps.LatLng(" & FORMAT$(cx) & "," & FORMAT$(cy) & ");" & $CRLF
           s += "    var myOptions = {" & $CRLF
           s += "      zoom: " & FORMAT$(zoom) & "," & $CRLF
           s += "      center: latlng," & $CRLF
           s += "      mapTypeId: google.maps.MapTypeId.ROADMAP" & $CRLF
           s += "    };" & $CRLF
           s += "    var map = new google.maps.Map(document.getElementById('map_canvas')," & $CRLF
           s += "        myOptions);" & $CRLF
           s += "  }" & $CRLF
           s += "</script>" & $CRLF
           s += "</head>" & $CRLF
           s += "<body scroll='no' onload='initialize()'>" & $CRLF
           s += "  <div id='map_canvas' style='width:100%; height:100%'></div>" & $CRLF
           s += "</body>" & $CRLF
           s += "</html>" & $CRLF
        
           ' // Save the script as a temporary file
           LOCAL bstrTempFileName AS WSTRING
           bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
        
           ' // Create the WebBrowser control with the embedded map
           LOCAL nWide, nHigh AS LONG
           DIALOG GET CLIENT hDlg TO nWide, nHigh
           pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, NOTHING, 0, 0, nWide, nHigh)
        
           ' // Display and activate the dialog
           DIALOG SHOW MODAL hDlg, CALL DlgProc
        
        END FUNCTION
        ' ########################################################################################
        
        ' ========================================================================================
        ' Main Dialog procedure
        ' ========================================================================================
        CALLBACK FUNCTION DlgProc() AS LONG
        
           SELECT CASE CBMSG
        
              CASE %WM_COMMAND
                 SELECT CASE CB.CTL
                    ' ...
                    ' ...
                 END SELECT
        
              CASE %WM_SIZE
                 IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                    ' // Resize the control
                    LOCAL nWide, nHigh AS LONG
                    DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                    CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                 END IF
        
           END SELECT
        
        END FUNCTION
        ' ========================================================================================
        Modified the code to please Google:

        Code:
        #COMPILE EXE
        #DIM ALL
        %UNICODE = 1
        
        ' // Include files for external files
        %USEWEBBROWSER = 1            ' // Use the WebBrowser control
        #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
        
        ' // Identifier
        %IDC_WEBBROWSER = 1001
        
        ' ########################################################################################
        ' Main
        ' ########################################################################################
        FUNCTION PBMAIN
        
           ' // Create the dialog
           LOCAL hDlg AS DWORD
           DIALOG NEW PIXELS, 0, "Google Map", , , 700, 400, %WS_OVERLAPPEDWINDOW TO hDlg
        
           ' // Create an instance of the class
           LOCAL pWindow AS IWindow
           pWindow = CLASS "CWindow"
           IF ISNOTHING(pWindow) THEN EXIT FUNCTION
        
           ' // Build the html script
           LOCAL s AS WSTRING
           LOCAL cx, cy AS DOUBLE
           LOCAL zoom AS LONG
           cx = 39.47#
           cy = 0.28#
           zoom = 7
        
           s  = "<!DOCTYPE html>" & $CRLF
           s += "<html>" & $CRLF
           s += "<head>" & $CRLF
           s += "<meta name='viewport' content='initial-scale=1.0, user-scalable=no' />" & $CRLF
        
           s += "      <meta http-equiv='X-UA-Compatible' content='IE=edge'>"   '--> added: used Edge browser
           s += "      <meta http-equiv='MSThemeCompatible' content='Yes'>"     '--> added: allow visual styles
        
           s += "<style type='text/css'>" & $CRLF
           s += "html { height: 100% }" & $CRLF
           s += "  body { height: 100%; margin: 0px; padding: 0px }" & $CRLF
           s += "  #map_canvas { height: 100% }" & $CRLF
        
           s += "         .infomsg {display:none;}"                            '--> added: workaround to ignore the message
        
           s += "</style>" & $CRLF
           s += "<script type='text/javascript'" & $CRLF
           s += "    src='http://maps.google.com/maps/api/js?sensor=false'>" & $CRLF
           s += "</script>" & $CRLF
           s += "<script type='text/javascript'>" & $CRLF
           s += "  function initialize() {" & $CRLF
           s += "    var latlng = new google.maps.LatLng(" & FORMAT$(cx) & "," & FORMAT$(cy) & ");" & $CRLF
           s += "    var myOptions = {" & $CRLF
           s += "      zoom: " & FORMAT$(zoom) & "," & $CRLF
           s += "      center: latlng," & $CRLF
           s += "      mapTypeId: google.maps.MapTypeId.ROADMAP" & $CRLF
           s += "    };" & $CRLF
           s += "    var map = new google.maps.Map(document.getElementById('map_canvas')," & $CRLF
           s += "        myOptions);" & $CRLF
           s += "  }" & $CRLF
           s += "</script>" & $CRLF
           s += "</head>" & $CRLF
           s += "<body scroll='no' onload='initialize()'>" & $CRLF
           s += "  <div id='map_canvas' style='width:100%; height:100%'></div>" & $CRLF
           s += "</body>" & $CRLF
           s += "</html>" & $CRLF
        
           ' // Save the script as a temporary file
           LOCAL bstrTempFileName AS WSTRING
           bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
        
           ' // Create the WebBrowser control with the embedded map
           LOCAL nWide, nHigh AS LONG
           DIALOG GET CLIENT hDlg TO nWide, nHigh
           pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, NOTHING, 0, 0, nWide, nHigh)
        
           ' // Display and activate the dialog
           DIALOG SHOW MODAL hDlg, CALL DlgProc
        
        END FUNCTION
        ' ########################################################################################
        
        ' ========================================================================================
        ' Main Dialog procedure
        ' ========================================================================================
        CALLBACK FUNCTION DlgProc() AS LONG
        
           SELECT CASE CBMSG
        
              CASE %WM_COMMAND
                 SELECT CASE CB.CTL
                    ' ...
                    ' ...
                 END SELECT
        
              CASE %WM_SIZE
                 IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                    ' // Resize the control
                    LOCAL nWide, nHigh AS LONG
                    DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                    CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                 END IF
        
           END SELECT
        
        END FUNCTION
        ' ========================================================================================
        Last edited by José Roca; 6 Sep 2017, 11:00 PM.
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Microsoft Virtual Earth Map

          Code:
          #COMPILE EXE
          #DIM ALL
          %UNICODE = 1
          
          ' // Include files for external files
          %USEWEBBROWSER = 1            ' // Use the WebBrowser control
          #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
          
          ' // Identifier
          %IDC_WEBBROWSER = 1001
          
          ' ########################################################################################
          ' Main
          ' ########################################################################################
          FUNCTION PBMAIN
          
             ' // Create the dialog
             LOCAL hDlg AS DWORD
             DIALOG NEW PIXELS, 0, "Virtual Earth Map", , , 700, 400, %WS_OVERLAPPEDWINDOW TO hDlg
          
             ' // Create an instance of the class
             LOCAL pWindow AS IWindow
             pWindow = CLASS "CWindow"
             IF ISNOTHING(pWindow) THEN EXIT FUNCTION
          
             ' // Build the html script
             LOCAL s AS WSTRING
             LOCAL cx, cy AS DOUBLE
             LOCAL zoom AS LONG
             cx = -6.89186#
             cy = 107.59987#
             zoom = 8
          
             s  = "<!DOCTYPE html>" & $CRLF
             s += "<html>" & $CRLF
             s += "<head>" & $CRLF
             s += "   <title>Virtual Earth Map</title>" & $CRLF
             s += "   <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & $CRLF
             s += "   <script type='text/javascript' src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6'>" & $CRLF
             s += "   </script>" & $CRLF
             s += "   <script type='text/javascript'>" & $CRLF
             s += "      var map = null;" & $CRLF
             s += "      var dyCodeCoord = new VELatLong(" & FORMAT$(cx) & ", " & FORMAT$(cy) & ");" & $CRLF
             s += "      function GetMap()" & $CRLF
             s += "         {" & $CRLF
             s += "            map = new VEMap('myMap');" & $CRLF
             s += "            map.LoadMap(dyCodeCoord," & FORMAT$(zoom) & ");" & $CRLF
             s += "         }" & $CRLF
             s += "   </script>" & $CRLF
             s += "   <style type='text/css'>" & $CRLF
             s += "      .map" & $CRLF
             s += "      {" & $CRLF
             s += "         position: absolute;" & $CRLF
             s += "         top: 0;" & $CRLF
             s += "         left: 0;" & $CRLF
             s += "         width: 100%;" & $CRLF
             s += "         height: 100%;" & $CRLF
             s += "      }" & $CRLF
             s += "   </style>" & $CRLF
             s += "</head>" & $CRLF
             s += "<body scroll='no' style='MARGIN: 0px 0px 0px 0px' onload='GetMap();'>" & $CRLF
             s += "<body>" & $CRLF
             s += "   <div id='myMap' class='map'>" & $CRLF
             s += "   </div>" & $CRLF
             s += "</body>" & $CRLF
             s += "</html>" & $CRLF
          
             ' // Save the script as a temporary file
             LOCAL bstrTempFileName AS WSTRING
             bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
          
             ' // Create the WebBrowser control with the embedded map
             LOCAL nWide, nHigh AS LONG
             DIALOG GET CLIENT hDlg TO nWide, nHigh
             pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, NOTHING, 0, 0, nWide, nHigh)
          
             ' // Display and activate the dialog
             DIALOG SHOW MODAL hDlg, CALL DlgProc
          
          END FUNCTION
          ' ########################################################################################
          
          ' ========================================================================================
          ' Main Dialog procedure
          ' ========================================================================================
          CALLBACK FUNCTION DlgProc() AS LONG
          
             SELECT CASE CBMSG
          
                CASE %WM_COMMAND
                   SELECT CASE CB.CTL
                      ' ...
                      ' ...
                   END SELECT
          
                CASE %WM_SIZE
                   IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                      ' // Resize the control
                      LOCAL nWide, nHigh AS LONG
                      DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                      CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                   END IF
          
             END SELECT
          
          END FUNCTION
          ' ========================================================================================
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment


          • #6
            YouTube
            Deprecated. YouTube now uses HTML5 Player instead of Shockwave Flash

            Code:
            #COMPILE EXE
            #DIM ALL
            %UNICODE = 1
            
            ' // Include files for external files
            %USEWEBBROWSER = 1            ' // Use the WebBrowser control
            #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
            
            ' // Identifier
            %IDC_WEBBROWSER = 1001
            
            ' ########################################################################################
            ' Main
            ' ########################################################################################
            FUNCTION PBMAIN
            
               ' // Create the dialog
               LOCAL hDlg AS DWORD
               DIALOG NEW PIXELS, 0, "YouTube", , , 450, 400, %WS_OVERLAPPEDWINDOW TO hDlg
            
               ' // Create an instance of the class
               LOCAL pWindow AS IWindow
               pWindow = CLASS "CWindow"
               IF ISNOTHING(pWindow) THEN EXIT FUNCTION
            
               ' // Build the html script
               LOCAL s AS WSTRING
            
               ' // Build the web page. Remember to always start it with "MSHTML:".
               s  = "MSHTML:<!DOCTYPE html>" & $CRLF
               s += "<html>" & $CRLF
               s += "<head>" & $CRLF
               s += "<meta http-equiv='MSThemeCompatible' content='Yes'>" & $CRLF
               s += "<title>YouTube video</title>" & $CRLF
               s += "" & $CRLF
               s += "</head>" & $CRLF
               s += "<body scroll='no' style='MARGIN: 0px 0px 0px 0px'>"
               s += "<object width='100%' height='100%'>" & _
                    "<param name='movie' value='http://www.youtube.com/v/t6Lp4w8wyy0&hl=es&fs=1'></param>" & _
                    "<param name='wmode' value='transparent'>" & _
                    "</param><embed src='http://www.youtube.com/v/t6Lp4w8wyy0&hl=es&fs=1'" & _
                    " type='application/x-shockwave-flash' wmode='transparent' width='100%' height='100%'>" & _
                    "</embed></object>"
               s += "" & $CRLF
               s += "</body>" & $CRLF
               s += "" & $CRLF
               s += "</html>" & $CRLF
            
               ' // Create the WebBrowser control with the embedded YouTube video
               LOCAL nWide, nHigh AS LONG
               DIALOG GET CLIENT hDlg TO nWide, nHigh
               pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, s, NOTHING, 0, 0, nWide, nHigh)
            
               ' // Display and activate the dialog
               DIALOG SHOW MODAL hDlg, CALL DlgProc
            
            END FUNCTION
            ' ########################################################################################
            
            ' ========================================================================================
            ' Main Dialog procedure
            ' ========================================================================================
            CALLBACK FUNCTION DlgProc() AS LONG
            
               SELECT CASE CBMSG
            
                  CASE %WM_COMMAND
                     SELECT CASE CB.CTL
                        ' ...
                        ' ...
                     END SELECT
            
                  CASE %WM_SIZE
                     IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                        ' // Resize the control
                        LOCAL nWide, nHigh AS LONG
                        DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                        CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                     END IF
            
               END SELECT
            
            END FUNCTION
            ' ========================================================================================
            Last edited by José Roca; 22 Jan 2020, 11:18 AM.
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


            • #7
              Windows Media Player

              Code:
              #COMPILE EXE
              #DIM ALL
              %UNICODE = 1
              
              ' // Include files for external files
              %USEWEBBROWSER = 1            ' // Use the WebBrowser control
              #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
              
              ' // Identifier
              %IDC_WEBBROWSER = 1001
              
              ' ########################################################################################
              ' Main
              ' ########################################################################################
              FUNCTION PBMAIN
              
                 ' // Create the dialog
                 LOCAL hDlg AS DWORD
                 DIALOG NEW PIXELS, 0, "Windows Media Player", , , 450, 400, %WS_OVERLAPPEDWINDOW TO hDlg
              
                 ' // Create an instance of the class
                 LOCAL pWindow AS IWindow
                 pWindow = CLASS "CWindow"
                 IF ISNOTHING(pWindow) THEN EXIT FUNCTION
              
                 ' // Add a WebBrowser control and display a video
                 LOCAL s AS WSTRING
                 LOCAL bstrURL AS WSTRING
              
                 bstrURL = "MyVideo.wmv"   ' --> change me
              
                 ' // Build the web page. Remember to always start it with "MSHTML:".
                 s  = "MSHTML:<!DOCTYPE html>" & $CRLF
                 s += "<html>" & $CRLF
                 s += "<head>" & $CRLF
                 s += "<meta http-equiv='MSThemeCompatible' content='Yes'>" & $CRLF
                 s += "<title>Windows Media Player</title>" & $CRLF
                 s += "" & $CRLF
                 s += "</head>" & $CRLF
                 s += "<body scroll='no' style='margin: 0px 0px 0px 0px'>"
                 s += "<object id='video' classid='clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6' type='application/x-oleobject' width='100%' height='100%'>" & $CRLF
                 s += "<param name='URL' value=" & bstrURL & ">" & $CRLF
                 s += "<param name='Enabled' value='true'>" & $CRLF
                 s += "<param name='AutoStart' value='true'>" & $CRLF
                 s += "<param name='StretchToFit' value='true'>" & $CRLF
                 s += "<param name='PlayCount' value='1'>" & $CRLF
                 s += "<param name='Volume' value='50'>" & $CRLF
                 s += "<param name='Balance'value='0'>" & $CRLF
                 s += "<param name='Rate' value='1.0'>" & $CRLF
                 s += "<param name='Mute' value='false'>" & $CRLF
                 s += "<param name='FullScreen' value='false'>" & $CRLF
                 s += "<param name='uiMode' value='full'>" & $CRLF
                 s += "</object>" & $CRLF
                 s += "" & $CRLF
                 s += "</body>" & $CRLF
                 s += "" & $CRLF
                 s += "</html>" & $CRLF
              
                 ' // Create the WebBrowser control with the embedded video
                 LOCAL nWide, nHigh AS LONG
                 DIALOG GET CLIENT hDlg TO nWide, nHigh
                 pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, s, NOTHING, 0, 0, nWide, nHigh)
              
                 ' // Display and activate the dialog
                 DIALOG SHOW MODAL hDlg, CALL DlgProc
              
              END FUNCTION
              ' ########################################################################################
              
              ' ========================================================================================
              ' Main Dialog procedure
              ' ========================================================================================
              CALLBACK FUNCTION DlgProc() AS LONG
              
                 SELECT CASE CBMSG
              
                    CASE %WM_COMMAND
                       SELECT CASE CB.CTL
                          ' ...
                          ' ...
                       END SELECT
              
                    CASE %WM_SIZE
                       IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                          ' // Resize the control
                          LOCAL nWide, nHigh AS LONG
                          DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                          CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                       END IF
              
                 END SELECT
              
              END FUNCTION
              ' ========================================================================================
              Forum: http://www.jose.it-berater.org/smfforum/index.php

              Comment


              • #8
                Windows Media Player (2)

                Code:
                #COMPILE EXE
                #DIM ALL
                %UNICODE = 1
                
                ' // Include files for external files
                %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                
                %IDC_WMP = 101
                
                ' ========================================================================================
                ' Main
                ' ========================================================================================
                FUNCTION PBMAIN
                
                   ' // Create the dialog
                   LOCAL hDlg AS DWORD
                   DIALOG NEW PIXELS, 0, "Windows Media Player", , , 450, 400, %WS_OVERLAPPEDWINDOW TO hDlg
                
                   ' // Create an instance of the class
                   LOCAL pWindow AS IWindow
                   pWindow = CLASS "CWindow"
                   IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                
                   ' // Display a Windows Media Player video
                   LOCAL bstrURL AS WSTRING
                   bstrURL = "MyVideo.wmv"   ' --> change me
                   LOCAL nWide, nHigh AS LONG
                   DIALOG GET CLIENT hDlg TO nWide, nHigh
                   pWindow.AddWindowsMediaPlayer(hDlg, %IDC_WMP, bstrURL, 0, 0, nWide, nHigh)
                
                   ' // Display and activate the dialog
                   DIALOG SHOW MODAL hDlg, CALL DlgProc
                
                END FUNCTION
                ' ========================================================================================
                
                ' ========================================================================================
                ' Main Dialog procedure
                ' ========================================================================================
                CALLBACK FUNCTION DlgProc() AS LONG
                
                   SELECT CASE CBMSG
                
                      CASE %WM_COMMAND
                         SELECT CASE CB.CTL
                            ' ...
                            ' ...
                         END SELECT
                
                      CASE %WM_SIZE
                         IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                            ' // Resize the control
                            LOCAL nWide, nHigh AS LONG
                            DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                            CONTROL SET SIZE CB.HNDL, %IDC_WMP, nWide, nHigh
                         END IF
                
                   END SELECT
                
                END FUNCTION
                ' ========================================================================================
                Forum: http://www.jose.it-berater.org/smfforum/index.php

                Comment


                • #9
                  WebBrowser Image Hyperlink

                  Code:
                  #COMPILE EXE
                  #DIM ALL
                  %UNICODE = 1
                  
                  ' // Include files for external files
                  %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                  #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                  
                  ' // Identifier
                  %IDC_WEBBROWSER = 1001
                  
                  ' ########################################################################################
                  ' Main
                  ' ########################################################################################
                  FUNCTION PBMAIN
                  
                     ' // Create the dialog
                     LOCAL hDlg AS DWORD
                     DIALOG NEW PIXELS, 0, "WebBrowser", , , 400, 260, %WS_OVERLAPPEDWINDOW TO hDlg
                  
                     ' // Create an instance of the class
                     LOCAL pWindow AS IWindow
                     pWindow = CLASS "CWindow"
                     IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                  
                     ' // Add a WebBrowser control
                     LOCAL bstrHTML AS WSTRING
                  
                     ' // Script to display the hyperlink
                     bstrHTML  = "MSHTML:" & $CRLF
                     bstrHTML += "<body scroll='no' style='margin: 0px 0px 0px 0px'>" & $CRLF
                     bstrHTML += "<a href='http://www.jose.it-berater.org/smfforum/index.php' target='_blank'>" & _
                                 "<img src='http://www.jose.it-berater.org/webpages_images/h_2.jpg' width='100%' height='100%' alt='Jose Roca Software'></a>"
                     bstrHTML += "</body>"
                  
                     ' // Create the WebBrowser control
                     LOCAL nWide, nHigh AS LONG
                     DIALOG GET CLIENT hDlg TO nWide, nHigh
                     pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrHTML, NOTHING, 45, 45, 311, 170)
                  
                     ' // Note: Right click with the mouse to activate the options menu
                  
                     ' // Display and activate the dialog
                     DIALOG SHOW MODAL hDlg, CALL DlgProc
                  
                  END FUNCTION
                  ' ########################################################################################
                  
                  ' ========================================================================================
                  ' Main Dialog procedure
                  ' ========================================================================================
                  CALLBACK FUNCTION DlgProc() AS LONG
                  
                     SELECT CASE CBMSG
                  
                        CASE %WM_COMMAND
                           SELECT CASE CB.CTL
                              ' ...
                              ' ...
                           END SELECT
                  
                     END SELECT
                  
                  END FUNCTION
                  ' ========================================================================================
                  Forum: http://www.jose.it-berater.org/smfforum/index.php

                  Comment


                  • #10
                    WebBrowser Display Pictures

                    Code:
                    #COMPILE EXE
                    #DIM ALL
                    %UNICODE = 1
                    
                    ' // Include files for external files
                    %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                    #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                    
                    ' // Identifier
                    %IDC_WEBBROWSER = 1001
                    
                    ' ########################################################################################
                    ' Main
                    ' ########################################################################################
                    FUNCTION PBMAIN
                    
                       ' // Create the dialog
                       LOCAL hDlg AS DWORD
                       DIALOG NEW PIXELS, 0, "WebBrowser", , , 600, 350, %WS_OVERLAPPEDWINDOW TO hDlg
                    
                       ' // Create an instance of the class
                       LOCAL pWindow AS IWindow
                       pWindow = CLASS "CWindow"
                       IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                    
                       ' // Add a WebBrowser control
                       LOCAL bstrHTML AS WSTRING
                    
                       ' // Script to display the picture
                       bstrHTML  = "MSHTML:" & $CRLF
                       bstrHTML += "<body scroll='auto' style='margin: 0px 0px 0px 0px'>" & $CRLF
                       bstrHTML += "<img src='http://celeb-world.net/d/4134-2/nicolekidman3.jpg' border='0' width='100%'></img>"
                       bstrHTML += "</body>"
                    
                       ' // Script to display the picture centered
                    '   bstrHTML  = "MSHTML:" & $CRLF
                    '   bstrHTML += "<body scroll='auto' style='margin: 0px 0px 0px 0px'>" & $CRLF
                    '   bstrHTML += "<center>" & $CRLF
                    '   bstrHTML += "<img src='http://celeb-world.net/d/4134-2/nicolekidman3.jpg' border='0' height='100%'></img>"
                    '   bstrHTML += "</center>" & $CRLF
                    '   bstrHTML += "</body>"
                    
                       ' // Create the WebBrowser control
                       LOCAL nWide, nHigh AS LONG
                       DIALOG GET CLIENT hDlg TO nWide, nHigh
                       pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrHTML, NOTHING, 0, 0, nWide, nHigh)
                    
                       ' // Note: Right click with the mouse to activate the options menu
                    
                       ' // Display and activate the dialog
                       DIALOG SHOW MODAL hDlg, CALL DlgProc
                    
                    END FUNCTION
                    ' ########################################################################################
                    
                    ' ========================================================================================
                    ' Main Dialog procedure
                    ' ========================================================================================
                    CALLBACK FUNCTION DlgProc() AS LONG
                    
                       SELECT CASE CBMSG
                    
                          CASE %WM_COMMAND
                             SELECT CASE CB.CTL
                                ' ...
                                ' ...
                             END SELECT
                    
                          CASE %WM_SIZE
                             IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                                ' // Resize the control
                                LOCAL nWide, nHigh AS LONG
                                DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                                CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                             END IF
                    
                       END SELECT
                    
                    END FUNCTION
                    ' ========================================================================================
                    Forum: http://www.jose.it-berater.org/smfforum/index.php

                    Comment


                    • #11
                      WebBrowser Control: CCS Dock Menu

                      The following example hosts an instance of the WebBrowser control and calls the Navigate2 method to load a web page that implements a CCS dock menu. Once loaded, it connects with the events fired by the page to detect which image has been clicked.

                      The CCS dock menu is the work of Nick La: http://www.ndesign-studio.com/blog/m.../css-dock-menu

                      I just have modified the .html pages to add identifiers to the anchors.

                      The attached file contains all you need to run the example. Preserve directory structure when unzipping to the folder of your choice.

                      Code:
                      ' ########################################################################################
                      ' This example demonstrates how to load a web page an detect which element has been clicked.
                      ' ########################################################################################
                      
                      ' CSED_PBWIN - Use the PBWIN compiler
                      #COMPILE EXE
                      #DIM ALL
                      %UNICODE = 1
                      
                      ' // Include files for external files
                      %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                      #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                      
                      %IDC_WEBBROWSER = 101
                      
                      ' ========================================================================================
                      ' Main
                      ' ========================================================================================
                      FUNCTION WinMain (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS WSTRINGZ PTR, BYVAL nCmdShow AS LONG) AS LONG
                      
                         ' // Create the dialog
                         LOCAL hDlg AS DWORD
                         DIALOG NEW PIXELS, 0, "YouTube", , , 650, 350, %WS_OVERLAPPEDWINDOW TO hDlg
                      
                         ' // Create an instance of the class
                         LOCAL pWindow AS IWindow
                         pWindow = CLASS "CWindow"
                         IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                      
                         ' // Add a WebBrowser control
                         LOCAL bstrURL AS WSTRING
                      
                         ' // You can pass a URL
                         bstrURL = EXE.Path$ & "css-dock-top.html"
                      
                         ' // Create an instance of the event class
                         LOCAL pWBEvents AS DWebBrowserEvents2Impl
                         pWBEvents = CLASS "CDWebBrowserEvents2"
                      
                         ' // Create the control
                         pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, pWBEvents, 0, 0, pWindow.ClientWidth, pWindow.ClientHeight)
                         CONTROL SET FOCUS hDlg, %IDC_WEBBROWSER
                      
                         ' // Display and activate the dialog
                         DIALOG SHOW MODAL hDlg, CALL DlgProc
                      
                      END FUNCTION
                      ' ========================================================================================
                      
                      ' ========================================================================================
                      ' Main Dialog procedure
                      ' ========================================================================================
                      CALLBACK FUNCTION DlgProc() AS LONG
                      
                         SELECT CASE CBMSG
                      
                            CASE %WM_COMMAND
                               SELECT CASE CB.CTL
                                  ' ...
                                  ' ...
                               END SELECT
                      
                            CASE %WM_SIZE
                               IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                                  ' // Resize the control
                                  LOCAL nWide, nHigh AS LONG
                                  DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                                  CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                               END IF
                      
                         END SELECT
                      
                      END FUNCTION
                      ' ========================================================================================
                      
                      ' ########################################################################################
                      ' Class CDWebBrowserEvents2
                      ' Interface name = DWebBrowserEvents2
                      ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
                      ' Web Browser Control events interface
                      ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
                      ' ########################################################################################
                      
                      CLASS CDWebBrowserEvents2 GUID$("{700B73A2-CCFC-4FE0-B9AC-D5853D71B7B9}") AS EVENT
                      
                         INSTANCE pIWebBrowser2 AS IWebBrowser2
                         INSTANCE pHTMLDocumentEvents2 AS HTMLDocumentEvents2Impl
                      
                         ' =====================================================================================
                         CLASS METHOD Destroy
                            ' Disconnect events
                            IF ISOBJECT(pHTMLDocumentEvents2) THEN EVENTS END pHTMLDocumentEvents2
                         END METHOD
                         ' =====================================================================================
                      
                      ' ========================================================================================
                      ' Implementation of the interface
                      ' ========================================================================================
                      INTERFACE DWebBrowserEvents2Impl GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}") AS EVENT
                      
                        INHERIT IDispatch
                      
                         ' =====================================================================================
                         METHOD BeforeNavigate2 <250> ( _
                           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
                         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
                         , BYREF vFlags AS VARIANT _                          ' __in VARIANT* Flags
                         , BYREF vTargetFrameName AS VARIANT _                ' __in VARIANT* TargetFrameName
                         , BYREF vPostData AS VARIANT _                       ' __in VARIANT* PostData
                         , BYREF vHeaders AS VARIANT _                        ' __in VARIANT* Headers
                         , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
                         )                                                    ' void
                      
                            ' Get a reference to the WebBrowser control
                            IF ISNOTHING(pIWebBrowser2) THEN pIWebBrowser2 = pDisp
                            IF ISNOTHING(pIWebBrowser2) THEN EXIT METHOD
                            ' If there was a previous loaded page, disconnect from the events
                            IF ISOBJECT(pHTMLDocumentEvents2) THEN
                               EVENTS END pHTMLDocumentEvents2
                               pHTMLDocumentEvents2 = NOTHING
                            END IF
                      
                         END METHOD
                         ' =====================================================================================
                      
                         ' =====================================================================================
                         METHOD DocumentComplete <259> ( _
                           BYVAL pDisp AS IDispatch _                         ' __in IDispatch* pDisp
                         , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
                         )                                                    ' void
                      
                            ' Get a reference to the IHTMLDocument2 interface
                            LOCAL pHTMLDocument2 AS IHTMLDocument2
                            pHTMLDocument2 = pIWebBrowser2.Document
                            IF ISNOTHING(pHTMLDocument2) THEN EXIT METHOD
                            ' Connect to the events fired by the page
                            pHTMLDocumentEvents2 = CLASS "CHTMLDocumentEvents2"
                            IF ISNOTHING(pHTMLDocumentEvents2) THEN EXIT METHOD
                            EVENTS FROM pHTMLDocument2 CALL pHTMLDocumentEvents2
                      
                         END METHOD
                         ' =====================================================================================
                      
                      END INTERFACE
                      
                      END CLASS
                      ' ########################################################################################
                      
                      
                      ' ########################################################################################
                      ' Class CHTMLDocumentEvents2
                      ' Interface name = HTMLDocumentEvents2
                      ' IID = {3050F613-98B5-11CF-BB82-00AA00BDCE0B}
                      ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
                      ' ########################################################################################
                      
                      CLASS CHTMLDocumentEvents2 GUID$("{1FFB0071-8BCC-4BBD-BC29-A662FAE87C82}") AS EVENT
                      
                      INTERFACE HTMLDocumentEvents2Impl GUID$("{3050F613-98B5-11CF-BB82-00AA00BDCE0B}") AS EVENT
                      
                        INHERIT IDispatch
                      
                         ' =====================================================================================
                         METHOD onclick <-600> ( _
                           BYVAL pEvtObj AS IHTMLEventObj _                   ' __in IHTMLEventObj* pEvtObj
                         )                                                    ' void
                      
                            LOCAL pElement AS IHTMLElement             ' // Element that has fired the event
                            LOCAL pHTMLDocument2 AS IHTMLDocument2     ' // Document object
                            LOCAL bstrId AS WSTRING                    ' // Identifier of the element that has fired the event
                      
                            ' // Get a reference to the element that has fired the event
                            IF ISOBJECT(pEvtObj) THEN pElement = pEvtObj.srcElement
                            IF ISNOTHING(pElement) THEN EXIT METHOD
                      
                            ' // Get a reference to the IHTMLDocument2 interface
                            pHTMLDocument2 = pElement.document
                            IF ISNOTHING(pHTMLDocument2) THEN EXIT METHOD
                      
                            ' // Get the identifier of the element that has fired the event
                            bstrId = pElement.id
                      
                            SELECT CASE bstrId
                               CASE "Home", "Contact", "Portfolio", "Music", "Video", "History", "Calendar", "Links", "RSS", "RSS2"
                                  MSGBOX "You have clicked " & bstrId
                            END SELECT
                      
                         END METHOD
                         ' =====================================================================================
                      
                      END INTERFACE
                      
                      END CLASS
                      ' ########################################################################################
                      Attached Files
                      Last edited by José Roca; 11 Feb 2012, 07:39 PM.
                      Forum: http://www.jose.it-berater.org/smfforum/index.php

                      Comment


                      • #12
                        HTML5: FishIE Tank

                        This is an adaptation of the Microsoft FishIE Tank demo ( http://ie.microsoft.com/testdrive/pe...ce/fishietank/ ), embedded in a PowerBASIC application instead of running it in a browser.

                        Code:
                        #COMPILE EXE
                        #DIM ALL
                        %UNICODE = 1
                        
                        ' // Include files for external files
                        %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                        #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                        
                        ' // Identifier
                        %IDC_WEBBROWSER = 101
                        
                        ' ########################################################################################
                        ' Main
                        ' ########################################################################################
                        FUNCTION PBMAIN () AS LONG
                        
                           ' // Create the dialog
                           LOCAL hDlg AS DWORD
                           DIALOG NEW PIXELS, 0, "FishIEThank", , , 750, 450, %WS_OVERLAPPEDWINDOW TO hDlg
                        
                           ' // Create an instance of the class
                           LOCAL pWindow AS IWindow
                           pWindow = CLASS "CWindow"
                           IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                        
                           ' // Add a WebBrowser control
                           LOCAL bstrURL AS WSTRING
                        
                           ' // You can pass a URL
                           bstrURL = EXE.Path$ & "FishIETank.htm"
                        
                           ' // Create the control
                           LOCAL nWide, nHigh AS LONG
                           DIALOG GET CLIENT hDlg TO nWide, nHigh
                           pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrURL, NOTHING, 0, 0, nWide, nHigh)
                        
                           ' // Display and activate the dialog
                           DIALOG SHOW MODAL hDlg, CALL DlgProc
                        
                        END FUNCTION
                        ' ########################################################################################
                        
                        ' ========================================================================================
                        ' Main Dialog procedure
                        ' ========================================================================================
                        CALLBACK FUNCTION DlgProc() AS LONG
                        
                           SELECT CASE CBMSG
                        
                              CASE %WM_COMMAND
                                 SELECT CASE CB.CTL
                                    ' ...
                                    ' ...
                                 END SELECT
                        
                              CASE %WM_SIZE
                                 IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                                    ' // Resize the control
                                    LOCAL nWide, nHigh AS LONG
                                    DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                                    CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                                 END IF
                        
                           END SELECT
                        
                        END FUNCTION
                        ' ========================================================================================
                        Attached Files
                        Forum: http://www.jose.it-berater.org/smfforum/index.php

                        Comment


                        • #13
                          Embedding the HTML5 Audio Player

                          This example demonstrates how to embed the HTML5 Audio Player.

                          Code:
                          ' ########################################################################################
                          ' Microsoft Windows
                          ' File: EX_DDT_HTML5_AudioPlayer.bas
                          ' Contents: Template - CWindow with HTML5 Audio Player
                          ' Compilers: PBWIN 10+, PBCC 6+
                          ' Headers: Windows API headers 3.0+
                          ' Copyright (c) 2012 José Roca. Freeware. Use at your own risk.
                          ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
                          ' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
                          ' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
                          ' ########################################################################################
                          #COMPILE EXE
                          #DIM ALL
                          %UNICODE = 1
                          
                          ' // Include files for external files
                          %USEWEBBROWSER = 1            ' // Use the WebBrowser control
                          #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
                          
                          ' // Identifier
                          %IDC_WEBBROWSER = 101
                          
                          ' ########################################################################################
                          ' Main
                          ' ########################################################################################
                          FUNCTION PBMAIN () AS LONG
                          
                             ' // Create the dialog
                             LOCAL hDlg AS DWORD
                             DIALOG NEW PIXELS, 0, "HTML5 Audio Player", , , 500, 200, %WS_OVERLAPPEDWINDOW TO hDlg
                          
                             ' // Create an instance of the class
                             LOCAL pWindow AS IWindow
                             pWindow = CLASS "CWindow"
                             IF ISNOTHING(pWindow) THEN EXIT FUNCTION
                          
                             ' // Build the html page
                             LOCAL s AS WSTRING
                          
                             s = "<!doctype html>" & $CRLF
                             s += "<head>" & $CRLF
                             s += "   <title>Audio Element Sample</title>" & $CRLF
                             s += "   <meta http-equiv='X-UA-Compatible' content='IE=9' />" & $CRLF
                             s += "</head>" & $CRLF
                             s += "<body>" & $CRLF
                             s += "    <h1>Audio Element Sample</h1>" & $CRLF
                             s += "    <!-- Display the audio player with control buttons. -->" & $CRLF
                             s += "    <!-- Remember to change the path of the url of the audio file. -->" & $CRLF
                             s += "    <audio src='" & EXE.PATH$ & "Kalimba.mp3' controls autoplay loop>" & $CRLF
                             s += "        HTML5 audio not supported" & $CRLF
                             s += "    </audio>" & $CRLF
                             s += "</body>" & $CRLF
                             s += "</html>" & $CRLF
                          
                             ' // Save the script as a temporary file
                             LOCAL bstrTempFileName AS WSTRING
                             bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
                          
                             ' // Create the WebBrowser control
                             LOCAL nWide, nHigh AS LONG
                             DIALOG GET CLIENT hDlg TO nWide, nHigh
                             pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, NOTHING, 0, 0, nWide, nHigh)
                          
                             ' // Display and activate the dialog
                             DIALOG SHOW MODAL hDlg, CALL DlgProc
                          
                          END FUNCTION
                          ' ########################################################################################
                          
                          ' ========================================================================================
                          ' Main Dialog procedure
                          ' ========================================================================================
                          CALLBACK FUNCTION DlgProc() AS LONG
                          
                             SELECT CASE CBMSG
                          
                                CASE %WM_COMMAND
                                   SELECT CASE CB.CTL
                                      ' ...
                                      ' ...
                                   END SELECT
                          
                                CASE %WM_SIZE
                                   IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                                      ' // Resize the control
                                      LOCAL nWide, nHigh AS LONG
                                      DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                                      CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                                   END IF
                          
                             END SELECT
                          
                          END FUNCTION
                          ' ========================================================================================
                          Forum: http://www.jose.it-berater.org/smfforum/index.php

                          Comment


                          • #14
                            Jose, thanks for posting! Question though, where do I find the CWindow.inc file?

                            Thanks!

                            Frank

                            Comment


                            • #15
                              Frank,

                              Check the first post in the Downloads forum just above this forum.

                              Comment


                              • #16
                                how can I get this to compile, getting error


                                Compiling "K:\PB\ast_UTIL\utl_Browser\GOOGLEPB.BAS"
                                Error 605 in K:\PB\AST_UTIL\UTL_BROWSER\MSHTMLC.INC(14077:004): Macro parameter mismatch
                                Line 14077: METHOD moveTo <6> ( _ ' VTable offset = 288

                                Comment


                                • #17
                                  Guess you have mixed the path to my headers withthe path to the PB includes.

                                  You must also be aware that these headers are not extensions to the ones provided with the compiler, but a full replacement. Therefore, you must not mix them with the PowerBASIC include files in any way, neither directly (via #INCLUDE), nor indirectly (via the include path in the IDE).
                                  Forum: http://www.jose.it-berater.org/smfforum/index.php

                                  Comment


                                  • #18
                                    Where can I find your version on your web site?

                                    Comment


                                    • #19
                                      I found them, now I am trying to figure out where to change the compiler include path?

                                      Comment


                                      • #20
                                        If you are using the PB IDE.. Windows-->Options-->Compiler-->Include File Paths.
                                        Forum: http://www.jose.it-berater.org/smfforum/index.php

                                        Comment

                                        Working...
                                        X