Put a web browser on your desktop

Just a few lines of code allow you to put a fully functioning custom web browser on your screen background.

If you’re not running the beta of VFP9, then remove the autocomplete property on the textbox below.

The AlwaysOnBottom puts the browser form below other VFP windows, so you can continue to use VFP.

Even when I navigate to a video, it shows on the VFP desktop.

The BindEvent allows the form to hook the resize event and resize the control to the form size when the user changes the VFP desktop size.

(Browsing on the VFP desktop has been around ever since VFP5 or 6: at least six years!)

 

With additional code, you can customize the browser even more, like adding tabbed pages or favorites.

PUBLIC ox

ox=NEWOBJECT("myformx")

BINDEVENT(_screen,"resize",ox,"resize")

ox.show

DEFINE CLASS myformx as Form

      ADD OBJECT txtURL as textbox WITH width=400,value="www.msn.com",autocomplete=3

      ADD OBJECT cmdRefresh as commandbutton WITH caption="\<Refresh",left=400,height=20

      ADD OBJECT cmdBack as commandbutton WITH caption="\<Back",left=475,height=20

      ADD OBJECT cmdForward as commandbutton WITH caption="\<Forward",left=550,height=20

     

      ADD OBJECT oweb as cweb WITH top=30

      width=800

      height=800

      alwaysonbottom=.t.

      allowoutput=.f.

      titlebar=0

      PROCEDURE init

            this.oweb.width=thisform.Width

            thisform.resize

            this.oweb.height=thisform.height-thisform.txtURL.height-2

            thisform.txtURL.valid

      PROCEDURE resize

            thisform.Width=_screen.Width

            thisform.Height=_screen.height

            this.oweb.top=30

            this.oweb.height=thisform.Height-100

            this.oweb.width=thisform.width-thisform.left

      PROCEDURE txtURL.valid

            thisform.oweb.navigate(this.value)

      PROCEDURE cmdRefresh.click

            thisform.oweb.refresh

      PROCEDURE cmdBack.click

            try

                  thisform.oweb.goback()

            CATCH

            endtry

      PROCEDURE cmdForward.click

            try

                  thisform.oweb.goForward()

            CATCH

            endtry

     

ENDDEFINE

DEFINE CLASS cweb as olecontrol

      oleclass="shell.explorer.2"

      PROCEDURE refresh

            nodefault

ENDDEFINE

26861