Welcome to MSDN Blogs Sign in | Join | Help

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

Published Friday, August 20, 2004 12:54 PM by Calvin_Hsia
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Put a web browser on your desktop

Saturday, August 21, 2004 10:02 PM by AKrisiun
* on method Resize must be :
this.oweb.width=thisform.width-thisform.oweb.left
this.oweb.height=thisform.Height-thisform.oweb.top

I tryed textbox change with OleControl textbox with SHAutoComplete
* ADD OBJECT txtURL as textbox
ADD OBJECT txtURL as UrlTextbox

DEFINE CLASS UrlTextBox AS olecontrol

OleClass = "MSMask.MaskEdBox"
TextValue = "www.google.com"
nLastKey = 0

FUNCTION Init

This.Object.Text = This.TextValue

DECLARE INTEGER SHAutoComplete IN Shlwapi.dll ;
INTEGER hwndEdit, INTEGER dwFlags

=ShAutoComplete( This.hWnd, 0x4 )

FUNCTION LostFocus()
This.Valid()

FUNCTION Valid
RETURN .T.

ENDDEFINE

ShAutocomplete works fine (in VFP6, VFP8 ... ! )
But problem with MaskEdBox control : its down have Valid event.

# re: Put a web browser on your desktop

Saturday, September 11, 2004 12:35 PM by Koen Piller
Hi,
I noticed that the text in the adress textbox does not change in the Procedure cmdBack.click

How could this be corrected?

Regards,

Koen

# Do you like reading a blog author? Retrieve all blog entries locally for reading/searching using XML, XSLT, XPATH

Wednesday, January 12, 2005 4:36 PM by Calvin Hsia's WebLog

# Do you like reading a blog author? Retrieve all blog entries locally for reading/searching using XML, XSLT, XPATH

Wednesday, January 12, 2005 5:01 PM by Calvin Hsia's WebLog

# Randy's Devcon Demo

Sunday, June 12, 2005 8:31 PM by Calvin Hsia's WebLog
Randy is using my blog as part of a Demo at the Devcon keynote. He has some Fox code running from Outlook...

# Customer question: what does the crash call stack mean

Thursday, December 07, 2006 7:59 PM by Calvin Hsia's WebLog

A customer asks: I read your article "Intentionally crash your program". I have some questions that I

# re: Put a web browser on your desktop

Friday, January 19, 2007 8:48 PM by JM

I have a browser into a form, but I need sometimes that the link that the user clicked on, to be opened at a new windows (of the browser predetermined of the user)

how I can do it ?=

Best regards, and sorry my bad english, I speak spanish. :)

# What's the difference between Internet Explorer and Explorer?

Thursday, September 27, 2007 8:22 PM by Calvin Hsia's WebLog

From the navigate bar of either, you can type a web URL like www.msn.com or a local file path like “c:\Windows”

# Control Web Browser | hilpers

Saturday, January 17, 2009 3:07 PM by Control Web Browser | hilpers

# Calvin Hsia s WebLog Put a web browser on your desktop | Green Tea Fat Burner

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker