Announcement

Collapse
No announcement yet.

José Roca's WebBrowser wrapper functions

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

    José Roca's WebBrowser wrapper functions

    José,

    This is fantastic. A browser that compiles to 74K in PB or 25K if compressed with Petite.

    The only thing I had to do to get the program to compile in PBWin 7.04 was to remove the BYVAL in the pszCmdLine AS ASCIIZ PTR in the following:
    Code:
    FUNCTION Project1_InitApplication _
      ( _
      BYVAL hInstance   AS DWORD, _       ' handle of current instance
      [b][i]BYVAL[/i][/b] pszCmdLine  AS ASCIIZ PTR _   ' address of command line
      ) AS LONG
     ' Initializes ATL
       AtlAxWinInit
    END FUNCTION
    Of course, I changed the default URL to http://www.powerbasic.com/support/forums/Ultimate.cgi. I think I will try to add a dropdown to the URL to give a small amount of URL history. However, I really like this!

    Thanks very much for sharing!

    ~Bob







    ------------------




    [This message has been edited by Bob Scott (edited March 30, 2005).]

    #2
    Agree, extremely cool and very generous of you to share all this work - thanks a lot, José!
    I seldom become impressed of anything these days, but this is truly impressive..


    ------------------
    PowerBASIC Staff
    ------------------
    Private web-site: http://www.tolkenxp.com/pb
    Free downloads: POFFS, incLean, PBcodec, custom controls and PB samples.

    Comment


      #3
      Thanks for your kind words. However, my plans are more ambitious than
      making a minibrowser. I want to make wrapper functions for the IHTMLDocument
      interface and a module to sink to the events fired by the HTML page
      (onclick, onkeypress, etc.). This will allow to create web pages on the
      fly that will be shown in the instance of the webbrowser embedded in your
      dialog and interact with the page via the events. It can be used for
      help windows, html forms, html tables, html reports (with find, print
      and printpreview), splash screens, html buttons and tooltips, html message
      boxes with hyperlinks, show images and videos... All that a browser is
      able to do, but working interactively with your application.

      A tip to create a tabbed browser like FireFox is to make a MDI application
      and in the NewWindow event create a MDI child window and a new instance of
      the webbrowser, and call the IWebBrowser2_SetRegisterAsBrowserwrapper function.
      The web page will be loaded in this new window instead of creating a new
      Internet Explorer window.
      ------------------




      [This message has been edited by José Roca (edited March 30, 2005).]
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


        #4
        webbrowser embedded in your dialog and interact with the page via the events
        WOW! José - So you will be able to make a "web-based GUI" for an application. That is sweet music!

        Regards
        Tonny


        ------------------

        Comment


          #5
          José,

          Terrific!
          Thanks for sharing with us.

          Regards,


          ------------------

          Comment


            #6
            WOW! José - So you will be able to make a "web-based GUI" for an application. That is sweet music!
            I have to do further research, but apparently it is possible. However,
            the programmer will need to have good knowledge of COM and HTML.

            Lets see:

            The GetDocument function will retrieve the dispatch pointer of the web
            page loaded in the browser. We will use this pointer to connect to the
            events fired by the page. If, for example, the user presses a key, the
            keypress event will be fired allowing us, among other things, to retrieve
            the keycode and a pointer to the IHTMLElement interface.

            At any time, the activeElement property of the IHTMLDocument2 interface
            can be used to retrieve a pointer to the IHTElement interface of the
            element that has the focus (sort of GetFocus function).

            There are interfaces and events for everything (MSHMTL is a huge component).
            This can lead to a different way of programming. You will design your GUI
            as a web page and work with events instead of notification messages,
            and COM instead of the Windows API.


            ------------------




            [This message has been edited by José Roca (edited March 30, 2005).]
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


              #7
              Jose,

              Very cool code! Thanks for sharing!

              Thanks,
              Flick


              ------------------

              Comment


                #8
                Hey Jose,

                this stuff looks GREAT!!!

                a one quick (dumb) question... I have a new machine.. that in which, I
                have deleted IEexplorer, Outlook and any AOL related stuff.. now I have
                had zero problems ...

                so.. curious.. as I havn't learned this ATL/Com etc stuff yet... can these
                wrappers also work using different browsers?, ie. firefox, opera ?

                Thanks!! Brad

                ------------------
                Washington DC Area
                Borje's "Poff's" is likely the BEST tool for learning PB.. http://www.tolkenxp.com/pb
                And a few PBTool's & Beginner Help:http://sweetheartgames.com/PBTools/JumpStart.html

                [This message has been edited by Brad D Byrne (edited March 31, 2005).]

                Comment


                  #9
                  Brad,

                  This is an IE specific interface, the same I am using in ZAP (which is based on JazzAge but without ATL).
                  As José stated you must have a good knowledge of both COM and HTML.

                  Good work José,
                  and very generous to share this code with the community,

                  Note: For those of you who have downloaded the WinLIFT demo,
                  you can see a complete HTML help file using this technology (embedded web browser).



                  ------------------
                  Patrice Terrier
                  mailto[email protected][email protected]</A>
                  www.zapsolution.com
                  Addons: WinLIFT (Skin Engine), GDI+ helper (Graphic package), dvBTree (Index manager)
                  Patrice Terrier
                  www.zapsolution.com
                  www.objreader.com
                  Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

                  Comment


                    #10
                    Jose, you've done great work with COM programming. Have you any lunk with COM servers? I was looking around on the internet and I found some asm exmaples of com servers with event sinks. I didn't know if that meant it could be done in PB as well. If your interested, I can dig up the link for you.

                    Steve

                    ------------------

                    Comment


                      #11
                      can these wrappers also work using different browsers?, ie. firefox, opera ?
                      It can be used with Mozilla and the Mozilla ActiveX control: http://www.iol.ie/~locka/mozilla/control.htm

                      However, it will not offer any advantage. The Microsoft WebBrowser is much more
                      advantageous for non English speaking users since context menus and dialogs are
                      localized.

                      Have you any lunk with COM servers?
                      This is a field where the cooperation of the compiler is needed. To code it
                      using low level COM techniques is difficult and nobody will do it. Philippe
                      has been offering since some years ago a free tool to do COM servers with PB,
                      JAOE17.

                      For those of you who have downloaded the WinLIFT demo, you can see a complete
                      HTML help file using this technology (embedded web browser).
                      ...which is based on JazzAge but without ATL
                      Yes, JACOM can be used to do it, but ATL has the advantage that that the
                      window used to host the OCX can be moved, resized, etc., using the Windows
                      API instead of JACOM specific functions. Anyway, JACOM is now free, so
                      anybody can post examples that use this tool. Philippe promissed more than
                      a month ago to make the source code available. Still waiting...

                      As I have said, my plans are not to make a browser, but to use the great
                      hosting capabilities of this control for different purposes. For example,
                      you can make an HTML message box creating a popup dialog that will host
                      the control and show an HTML page that you can create on the fly in memory
                      (no need to save it to the disk). This can include, for example, an
                      hyperlink to your web page where the user can find further information.
                      You can also make a report using html and show it in a window of your
                      dialog, with the ability of print and print preview. Much more...


                      ------------------


                      [This message has been edited by José Roca (edited March 31, 2005).]
                      Forum: http://www.jose.it-berater.org/smfforum/index.php

                      Comment


                        #12
                        Jose, the mozilla control doesn't appear in my com browser.
                        After reading it seems to need the mozilla browser to be installed also.

                        Am i wrong?
                        I have not installed Mozilla browser.

                        Thanks,

                        ------------------
                        http://www.hellobasic.com
                        PwrDev - Visual Designer for pb/dll, pb/win, pb/cc
                        PwrStat - Static library linker for pb/dll or pb/win.
                        hellobasic

                        Comment


                          #13
                          The Mozilla control provides the wrapper code that converts between the
                          IWebBrowser and the internal Gecko engine interfaces and catches Gecko
                          events and fires the appropriate ActiveX events.

                          So you need to install both the Mozilla Browser and the WebBrowser wrapper.

                          Besides some minor differences, like having to add the WS_HSCROLL and
                          WS_VSCROLL styles to the window (otherwise you won't be able to scroll
                          the window), and of course the ProgID, this wrapper doesn't provide a
                          full implementation of the DOM model.

                          All this is explained in the link that I have provided:

                          http://www.iol.ie/~locka/mozilla/control.htm


                          ------------------




                          [This message has been edited by José Roca (edited March 31, 2005).]
                          Forum: http://www.jose.it-berater.org/smfforum/index.php

                          Comment


                            #14
                            …you can make an HTML message box…
                            The QHTM control, http://www.gipsysoft.com/ , provides an html message box and doesn’t require IE.

                            Keith


                            ------------------

                            Comment


                              #15
                              Oh – that’s odd. I’ve just noticed that apostrophise and ellipsis’s (three full stops) are coming out as question marks. Click on the "edit post" icon to see what I mean.

                              ------------------

                              Comment


                                #16
                                The QHTM control, http://www.gipsysoft.com/ , provides an html message box and doesn’t require IE.
                                Yes, but it does require a DLL, you have to pay $65 each time
                                ("You get to use QHTM in one product and for one developer only"),
                                and you don't learn anything. Someone has to learn how to do things
                                if you want to have tools. Besides, the WebBrowser lets you to do
                                more things than QHTM.


                                ------------------
                                Forum: http://www.jose.it-berater.org/smfforum/index.php

                                Comment


                                  #17
                                  That's new to me..
                                  QHTM was free except for some pro version afaik.



                                  ------------------
                                  http://www.hellobasic.com
                                  PwrDev - Visual Designer for pb/dll, pb/win, pb/cc
                                  PwrStat - Static library linker for pb/dll or pb/win.
                                  hellobasic

                                  Comment


                                    #18
                                    It is free for non-commercial use.


                                    ------------------
                                    Forum: http://www.jose.it-berater.org/smfforum/index.php

                                    Comment


                                      #19
                                      i have posted code to allow interactivity with a web page loaded in
                                      an instance of the webbrowser control embedded in a pbwin application.

                                      http://www.powerbasic.com/support/pb...ad.php?t=24546


                                      hope that someone with better knowledge of html than me will post a
                                      better example showing the possibilities.


                                      ------------------
                                      Forum: http://www.jose.it-berater.org/smfforum/index.php

                                      Comment


                                        #20
                                        in the "webbrowser wrapper functions" thread (source code forum), i have
                                        posted a technique to save the web page without prompting.
                                        http://www.powerbasic.com/support/pb...ad.php?t=24548


                                        ------------------
                                        Forum: http://www.jose.it-berater.org/smfforum/index.php

                                        Comment

                                        Working...
                                        X
                                        😀
                                        🥰
                                        🤢
                                        😎
                                        😡
                                        👍
                                        👎