PUBLIC oForm
oForm = CREATEOBJECT("form")
oForm.addobject("edit1","editbox")
oForm.edit1.visible=.t.
oform.height = 400
oform.width = 400
oform.edit1.width=390
oform.edit1.height=390
oForm.autocenter=.t.
oForm.edit1.controlsource = "mycursor.contents"
Create Cursor myCursor (contents m)
Append Blank
Replace contents With FETCHURL( "http://www.microsoft.com" ) && Change this as required
oForm.show()
Function FETCHURL
Lparameters pcUrlName
Declare Integer InternetOpen In wininet.Dll String sAgent, ;
INTEGER lAccessType, String sProxyName, ;
STRING sProxyBypass, Integer lFlags
Declare Integer InternetOpenUrl In wininet.Dll ;
INTEGER hInternetSession, String sUrl, String sHeaders, ;
INTEGER lHeadersLength, Integer lFlags, Integer lContext
Declare Integer InternetReadFile In wininet.Dll Integer hfile, ;
STRING @sBuffer, Integer lNumberofBytesToRead, Integer @lBytesRead
Declare short InternetCloseHandle In wininet.Dll Integer hInst
#Define INTERNET_OPEN_TYPE_PRECONFIG 0
#Define INTERNET_OPEN_TYPE_DIRECT 1
#Define INTERNET_OPEN_TYPE_PROXY 3
#Define SYNCHRONOUS 0
#Define INTERNET_FLAG_RELOAD 2147483648
#Define CR Chr(13)
Local lsAgent, lhInternetSession, lhUrlFile, llOk, lnOk, lcRetVal, lcReadBuffer, lnBytesRead
lsAgent = "VPF"
lhInternetSession = InternetOpen( lsAgent, INTERNET_OPEN_TYPE_PRECONFIG, ;
', ', SYNCHRONOUS)
If lhInternetSession = 0
Wait Window "Internet session cannot be established" Time 2
Return .Null.
Endif
lhUrlFile = InternetOpenUrl( lhInternetSession, pcUrlName, ', 0, ;
INTERNET_FLAG_RELOAD, 0)
If lhUrlFile = 0
Wait Window "URL cannot be opened"
Return .Null.
Endif
lcRetVal = ""
llOk = .T.
Do While llOk
lsReadBuffer = Space(32767)
lnBytesRead = 0
lnOk = InternetReadFile( lhUrlFile, @lsReadBuffer, Len(lsReadBuffer), @lnBytesRead)
If ( lnBytesRead > 0 )
lcRetVal = lcRetVal + Left( lsReadBuffer, lnBytesRead )
Endif
llOk = ( lnOk = 1 ) And ( lnBytesRead > 0 )
Enddo
InternetCloseHandle( lhUrlFile )
InternetCloseHandle( lhInternetSession )
Return lcRetVal
Endfunc