Module Module2 Private Const INTERNET_FLAG_RELOAD = &H80000000 Private Declare Auto Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (ByVal hInternetSession As Integer, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Integer, ByVal dwFlags As Integer, ByVal dwContext As Integer) As Integer Private Declare Auto Function InternetReadFile Lib "wininet" (ByVal hFile As Integer, ByVal sBuffer As String, ByVal lNumBytesToRead As Integer, ByVal lNumberofBytesRead As Integer) As Integer Private Const INTERNET_OPEN_TYPE_DIRECT = 1 Declare Auto Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer Friend Declare Auto Function InternetCloseHandle Lib "wininet" (ByRef hInet) As Integer Friend hOpen As Integer Friend Sub ShowTitle()hOpen = InternetOpen( "App1", INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0) Dim sBuffer As String = Space(1000) '1000 characters must surely be enough. Dim hFile As Integer Dim Ret As Integer Dim sPath As String = "http://www.google.co.uk/"hFile = InternetOpenUrl(hOpen, sPath, vbNullString, 0&, INTERNET_FLAG_RELOAD, 0&) InternetReadFile(hFile, sBuffer, 1000, Ret) InternetCloseHandle(hFile) Debug.Print(sBuffer) Dim t1 As Long Dim t2 As Longt1 = InStr(sBuffer, "<TITLE>") + 7t2 = InStr(sBuffer, "</TITLE>") If t1 <> 0 And t2 <> 0 Then Debug.Print(Mid$(sBuffer, t1, t2 - t1))InternetCloseHandle(hOpen) End SubEnd Module |
But sBuffer doesn't get filled. Any thoughts

Obtaining a web page's title
mimino
I'm confused. Are you asking why it doesn't work Cannot do in .Net How to in VFP Anyway mostly based on your codes this works under VFP (title was "Google":)
#Define INTERNET_FLAG_RELOAD 0x80000000
#Define INTERNET_OPEN_TYPE_DIRECT 1
Declare Integer InternetOpenUrl In wininet.Dll ;
integer hInternetSession, String lpszUrl, String lpszHeaders,;
integer dwHeadersLength, Integer dwFlags, Integer dwContext
Declare Integer InternetReadFile In wininet.Dll ;
integer hFile, ;
string @ sBuffer, ;
integer lNumBytesToRead, Integer @ lNumberofBytesRead
Declare Integer InternetOpen In wininet.Dll ;
string sAgent, ;
integer lAccessType, ;
string sProxyName,;
string sProxyBypass, ;
integer lFlags
Declare Integer InternetCloseHandle In wininet.Dll Integer hInet
hOpen = InternetOpen("App1", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0)
sBuffer = Space(1000) && 1000 characters must surely be enough.
sPath = "http://www.google.co.uk/"
Ret = 0
hFile = InternetOpenUrl(hOpen, sPath, 0, 0, INTERNET_FLAG_RELOAD, 0)
InternetReadFile(hFile, @sBuffer, Len(sBuffer), @Ret)
InternetCloseHandle(hFile)
InternetCloseHandle(hOpen)
STREXTRACT(sBuffer,'<title>','</title>',1,1)
MizzouTiger
BobK_MN
Mhd. akram
Update: Check
http://msdn2.microsoft.com/en-us/library/b7810t5c.aspx
Todd West
Kaz
This raises a wider question - how do I get hold of API declarations for .net In VB6 there was the handy API viewer utility, but there doesn't seem to be any equivalent in .net.
Snkscore
Lagear
Why would you need API like this in .Net It at least is known as .NET and not surprisingly have System.Net namespace. Use classes from there like WebRequest, FtpWebRequest (2.0).