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
Comments
Anonymous
August 21, 2004on 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.Anonymous
September 11, 2004
Hi,
I noticed that the text in the adress textbox does not change in the Procedure cmdBack.click
How could this be corrected?
Regards,
KoenAnonymous
June 12, 2005
The comment has been removedAnonymous
December 07, 2006
A customer asks: I read your article "Intentionally crash your program". I have some questions that IAnonymous
January 19, 2007
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. :)Anonymous
September 27, 2007
From the navigate bar of either, you can type a web URL like www.msn.com or a local file path like “c:Windows”Anonymous
January 17, 2009
PingBack from http://www.hilpers-esp.com/709998-control-web-browserAnonymous
June 07, 2009
PingBack from http://greenteafatburner.info/story.php?id=3748