Hi i'm new here and i want to know something in vb6 i'm new in vb6
i want to read txt file from website in to Textbox in vb6
i found some source in google but watch this
for example:
Attachment 95619
Attachment 95621
ok but if program is open and if i update text on website then when i click get data is not working , i need to close and to re-open program then i will get new data.
but i want if i update text on website i want to get data immediately
because this source which i have downloads text file save in C:\name.txt and then Writen in textbox
if there is another source to get txt data directly from website please help me.
here is source code which i'm using
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Private Sub Command1_Click()
Dim sSourceUrl As String
Dim sLocalFile As String
Dim hfile As Long
sSourceUrl = "http://www.commerce-paitalk.com/usrnames.txt"
sLocalFile = "c:\root.txt"
If DownloadFile(sSourceUrl, sLocalFile) Then
hfile = FreeFile
Open sLocalFile For Input As #hfile
Text1.Text = Input$(LOF(hfile), hfile)
Close #hfilee
End If
End Sub
Public Function DownloadFile(sSourceUrl As String, _
sLocalFile As String) As Boolean
'Download the file. BINDF_GETNEWESTVERSION forces
'the API to download from the specified source.
'Passing 0& as dwReserved causes the locally-cached
'copy to be downloaded, if available. If the API
'returns ERROR_SUCCESS (0), DownloadFile returns True.
DownloadFile = URLDownloadToFile(0&, _
sSourceUrl, _
sLocalFile, _
BINDF_GETNEWESTVERSION, _
0&) = ERROR_SUCCESS
i want to read txt file from website in to Textbox in vb6
i found some source in google but watch this
for example:
Attachment 95619
Attachment 95621
ok but if program is open and if i update text on website then when i click get data is not working , i need to close and to re-open program then i will get new data.
but i want if i update text on website i want to get data immediately
because this source which i have downloads text file save in C:\name.txt and then Writen in textbox
if there is another source to get txt data directly from website please help me.
here is source code which i'm using
Quote:
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Private Sub Command1_Click()
Dim sSourceUrl As String
Dim sLocalFile As String
Dim hfile As Long
sSourceUrl = "http://www.commerce-paitalk.com/usrnames.txt"
sLocalFile = "c:\root.txt"
If DownloadFile(sSourceUrl, sLocalFile) Then
hfile = FreeFile
Open sLocalFile For Input As #hfile
Text1.Text = Input$(LOF(hfile), hfile)
Close #hfilee
End If
End Sub
Public Function DownloadFile(sSourceUrl As String, _
sLocalFile As String) As Boolean
'Download the file. BINDF_GETNEWESTVERSION forces
'the API to download from the specified source.
'Passing 0& as dwReserved causes the locally-cached
'copy to be downloaded, if available. If the API
'returns ERROR_SUCCESS (0), DownloadFile returns True.
DownloadFile = URLDownloadToFile(0&, _
sSourceUrl, _
sLocalFile, _
BINDF_GETNEWESTVERSION, _
0&) = ERROR_SUCCESS