PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Besoin d'un traducteur
Besoin d'un traducteur
Débuté par NiCo, 17 jan. 2006 10:40 - 1 réponse
Posté le 17 janvier 2006 - 10:40
Bonjour,

Voilà, dans le cadre d'un projet pour mon école, j'aurais besoin que
quelqu'un d'assez expérimenté en vb et W-Langage me traduise ce module
écrit en vb6 en W-Langage. Voici le code du module :

Option Explicit

Public Enum TypeDeFichier
FichierAscii = False
FichierBinaire = True
End Enum

Public Declare Function InternetOpen Lib "wininet.dll" _
Alias "InternetOpenA" _
(ByVal lpszAgent As String, _
ByVal dwAccessType As Long, _
ByVal lpszProxyName As String, _
ByVal lpszProxyBypass As String, _
ByVal dwFlags As Long) _
As Long
Public Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Long
Public Declare Function InternetOpenUrl Lib "wininet.dll" _
Alias "InternetOpenUrlA" _
(ByVal hInternetSession As Long, _
ByVal lpszUrl As String, _
ByVal lpszHeaders As String, _
ByVal dwHeadersLength As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) _
As Long
Public Declare Function InternetReadFile Lib "wininet.dll" _
(ByVal hFile As Long, _
ByVal lpBuffer As String, _
ByVal dwNumberOfBytesToRead As Long, _
lNumberOfBytesRead As Long) _
As Long
Public Declare Function DeleteUrlCacheEntry Lib "wininet.dll" _
Alias "DeleteUrlCacheEntryA" _
(ByVal lpszUrlName As String) _
As Integer

Public Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Public Const INTERNET_FLAG_RELOAD = &H80000000

Public hSession As Long
Public hUrlFile As Long



Public Function OuvrirURL(sURL As String, FileType As TypeDeFichier) As
String
Dim Buffer As String * 256
Dim Info As String
Dim NombreOctets As Long
Dim ValRet As Long
Dim R As Integer

Screen.MousePointer = vbHourglass
On Error GoTo Err_Lecture

DeleteUrlCacheEntry sURL

hSession = InternetOpen(App.Title, _
INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, _
vbNullString, _
0)
hUrlFile = InternetOpenUrl(hSession, _
sURL, _
vbNullString, _
0, _
INTERNET_FLAG_RELOAD, _
0)
Select Case FileType
Case True
Do
ValRet = InternetReadFile(hUrlFile, _
Buffer, _
Len(Buffer), _
NombreOctets)
If NombreOctets > 0 Then Info = Info & Buffer
DoEvents
Loop Until NombreOctets = 0
InternetCloseHandle (hUrlFile)
InternetCloseHandle (hSession)
If Len(Info) = 0 Then
OuvrirURL = False
Screen.MousePointer = vbNormal
Exit Function
End If
Case False
ValRet = InternetReadFile(hUrlFile, _
Buffer, _
Len(Buffer), _
NombreOctets)
InternetCloseHandle (hUrlFile)
InternetCloseHandle (hSession)
If NombreOctets = 0 Then
OuvrirURL = False
Screen.MousePointer = vbNormal
Exit Function
End If
Info = Left$(Buffer, NombreOctets)
End Select
DeleteUrlCacheEntry sURL
Screen.MousePointer = vbNormal
OuvrirURL = Info
Exit Function

Err_Lecture:
OuvrirURL = False
Screen.MousePointer = vbNormal
Exit Function

End Function

Merci d'avance ;)
Posté le 17 janvier 2006 - 13:07
On dirait bien que ca télécharge un fichier...
Tu peux donc utiliser HttpRequete()