G
Guest
Hi please can someone help me, i'm so desperate.
I'm trying to write a small app in vb.net cf that basically uploads a file
to a server from a pocket pc 2003
I've been using wininet without any success. the ftpputfile just won't work!
the code is below if its a simple case of my stupidity! Internetconnect and
internetopen return values without problem but ftpputfile is always false.
I've downloaded IPworks and used their excellent library and it works
brilliantly but i cann't use external libs or any 3rd party stuff in this
app. ANyone got any suggestions how it might be possible to write a simple
library thing? all i need is connect and upload! I've seen a few that look
easy but they're in C# and my C# is uselss!
Thanks so much i really appreciate any time you can give.
Declare Function InternetConnect Lib "wininet" Alias "InternetConnectW"
(ByVal hInet As Integer, ByVal lpszServerName As String, ByVal nServerPort As
Integer, ByVal lpszUserName As String, ByVal lpszPassword As String, ByVal
dwService As Integer, ByVal dwFlags As Integer, ByVal dwContext As Integer)
As Integer
Declare Function FtpPutFile Lib "wininet" Alias "FtpPutFileA" (ByVal
hFtpSession As Integer, ByVal lpszLocalFile As String, ByVal lpszRemoteFile
As String, ByVal dwFlags As Integer, ByVal dwContext As Integer) As Boolean
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal
sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String,
ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer
Public Const INTERNET_SERVICE_FTP As Integer = 1
Public Const INTERNET_OPEN_TYPE_PRECONFIG As Integer = 0
Public Const INTERNET_FLAG_PASSIVE As Integer = 0
Dim INet As Integer
Dim INetConn As Integer
Dim RC As Boolean
On Error Resume Next
INet = InternetOpen(("testftp2"), INTERNET_OPEN_TYPE_PRECONFIG,
vbNullString, vbNullString, 0)
INetConn = InternetConnect(INet, "myserver", 21, "username", "password",
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
RC = FtpPutFile(INetConn, "/My Documents/Hello.txt", "file1.txt", 4, 4)
If RC = True Then
MsgBox("Transfer succesfull!")
Else
MsgBox("transfer failed " & Err.Description)
End If
InternetCloseHandle(INetConn)
InternetCloseHandle(INet)
I'm trying to write a small app in vb.net cf that basically uploads a file
to a server from a pocket pc 2003
I've been using wininet without any success. the ftpputfile just won't work!
the code is below if its a simple case of my stupidity! Internetconnect and
internetopen return values without problem but ftpputfile is always false.
I've downloaded IPworks and used their excellent library and it works
brilliantly but i cann't use external libs or any 3rd party stuff in this
app. ANyone got any suggestions how it might be possible to write a simple
library thing? all i need is connect and upload! I've seen a few that look
easy but they're in C# and my C# is uselss!
Thanks so much i really appreciate any time you can give.
Declare Function InternetConnect Lib "wininet" Alias "InternetConnectW"
(ByVal hInet As Integer, ByVal lpszServerName As String, ByVal nServerPort As
Integer, ByVal lpszUserName As String, ByVal lpszPassword As String, ByVal
dwService As Integer, ByVal dwFlags As Integer, ByVal dwContext As Integer)
As Integer
Declare Function FtpPutFile Lib "wininet" Alias "FtpPutFileA" (ByVal
hFtpSession As Integer, ByVal lpszLocalFile As String, ByVal lpszRemoteFile
As String, ByVal dwFlags As Integer, ByVal dwContext As Integer) As Boolean
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal
sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String,
ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer
Public Const INTERNET_SERVICE_FTP As Integer = 1
Public Const INTERNET_OPEN_TYPE_PRECONFIG As Integer = 0
Public Const INTERNET_FLAG_PASSIVE As Integer = 0
Dim INet As Integer
Dim INetConn As Integer
Dim RC As Boolean
On Error Resume Next
INet = InternetOpen(("testftp2"), INTERNET_OPEN_TYPE_PRECONFIG,
vbNullString, vbNullString, 0)
INetConn = InternetConnect(INet, "myserver", 21, "username", "password",
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
RC = FtpPutFile(INetConn, "/My Documents/Hello.txt", "file1.txt", 4, 4)
If RC = True Then
MsgBox("Transfer succesfull!")
Else
MsgBox("transfer failed " & Err.Description)
End If
InternetCloseHandle(INetConn)
InternetCloseHandle(INet)