Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Jooel,
Yes, we have now skipped ADO and have gone to a different methodology. Now, we need to get Public Function, Alias, and ByVal nailed down.
Here is what I have so far: code:
BREAK ON CLS ; Ref - http://www.geocities.co.jp/SiliconValley/4805/vbtips/vbtips103.htm FtpPut("ftp://ftpserver","kdyer","pw","ftp://ftpserver/kdyer/kdyer/test.jpg","c:\untitled1.jpg") FUNCTION FtpPut($strftpsvr, $struserid, $strpassword, $strremotefile, $strlocalfile) DIM $hinternet DIM $hftp DIM $lngret DIM $strerrtext
$ftpput = True
IF @Error <> 0 GOTO ErrHandler ENDIF
;INTERNET_OPEN_TYPE_PRECONFIG = 0& $hinternet = InternetOpen("",0&,"","",0&) IF $hinternet = 0 $strerrtext = "InternetOpen:GetLastError=" + $err.lastdllerror() MESSAGEBOX ($strerrtext, $app.title + "<FtpPut>", 0) $ftpput = NOT 1 RETURN ENDIF
;INTERNET_DEFAULT_FTP_PORT = 21& ;INTERNET_SERVICE_FTP = 1& $hftp = InternetConnect($hinternet, _ $strftpsvr, _ 21&, _ $struserid, _ $strpassword, _ 1&, _ 0&, _ 0&) IF $hftp = 0 $strerrtext = "InternetConnect:GetLastError=" + $err.lastdllerror() MESSAGEBOX($strerrtext, $app.title + "<FtpPut>", 0) $ftpput = NOT 1 RETURN ENDIF
;FTP_TRANSFER_TYPE_BINARY = &H2& $lngret = FtpPutFile($hftp, _ $strlocalfile, _ $strremotefile, _ &H2&, _ 0&) $lngret = InternetCloseHandle($hftp) $lngret = InternetCloseHandle($hinternet) RETURN :ErrHandler $ftpput = NOT 1 MESSAGEBOX( "<" + $err + ">" + Error($err), $app.title + "<FtpPut>", 0 ) ENDFUNCTION
;------------------------------------------------------- ; Module ;------------------------------------------------------- ;constants ;INTERNET_OPEN_TYPE_PRECONFIG = 0& ;INTERNET_OPEN_TYPE_DIRECT = 1& ;INTERNET_OPEN_TYPE_PROXY = 3& ;INTERNET_DEFAULT_FTP_PORT = 21& ;INTERNET_DEFAULT_HTTP_PORT = 80& ;INTERNET_DEFAULT_HTTPS_PORT = 443& ;INTERNET_SERVICE_FTP As = 1& ;INTERNET_SERVICE_HTTP = 3& ;INTERNET_FLAG_PASSIVE = &H8000000 ;INTERNET_FLAG_RELOAD = &H80000000 ;FTP_TRANSFER_TYPE_ASCII = &H1& ;FTP_TRANSFER_TYPE_BINARY = &H2&
;API??
FUNCTION InternetOpen(Add($lpszAgent,"WinInet.DLL"),Add($dwAccessType,"WinInet.DLL"), Add($lpszProxyName,"WinInet.DLL"),Add($lpszProxyBypass,"WinInet.DLL"0,Add($dwFlags,"WinInet.DLL") ; ;$inetopcstr = "wininet.dll" ; ;$inetopcstr = $inetopcstr + "InternetOpenA" + chr(40) ; $inetopcstr = $inetopcstr + Add($lpszAgent,"WinInet.DLL") + chr(44) ; $inetopcstr = $inetopcstr + Add($dwAccessType,"WinInet.DLL") + chr(44) ; $inetopcstr = $inetopcstr + Add($lpszProxyName,"WinInet.DLL") + chr(44) ; $inetopcstr = $inetopcstr + Add($lpszProxyBypass,"WinInet.DLL") + chr(44) ; $inetopcstr = $inetopcstr + Add($dwFlags,"WinInet.DLL") ENDFUNCTION
FUNCTION InternetConnect($inetcstr) $inetcstr = "WinInet.DLL" $inetcstr = $inetcstr + "InternetConnectA" + chr(40) $inetcstr = $inetcstr + Add($hInternetSession,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($lpszServerName,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($nServerPort,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($lpszUserName,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($lpszPassword,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($dwService,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($dwFlags,"WinInet.DLL") + chr(44) $inetcstr = $inetcstr + Add($dwContext,"WinInet.DLL") + chr(41) ENDFUNCTION
FUNCTION FtpPutFile($inetftpput) $inetftpput = "wininet.dll" $inetftpput = $inetftpput + "FtpPutFileA" + chr(40) $inetftpput = $inetftpput + Add($hFtpSession,"WinInet.DLL") + chr(44) $inetftpput = $inetftpput + Add($lpszLocalFile,"WinInet.DLL") + chr(44) $inetftpput = $inetftpput + Add($lpszNewRemoteFile,"WinInet.DLL") + chr(44) $inetftpput = $inetftpput + Add($dwFlags,"WinInet.DLL") + chr(44) $inetftpput = $inetftpput + Add($dwContext,"WinInet.DLL") + chr(41) ENDFUNCTION
FUNCTION InternetCloseHandle($inetclose) $inetclose = "wininet.dll" $inetclose = $inetclose + Add($hInternetSession,"WinInet.DLL") + chr(41) ENDFUNCTION
; - Function Add is from Shawn Tassie since byval is not supported by KiX ; - ref - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=13;t=000017 FUNCTION Add($var1,$var2byref) ; ; Add Var1 to Var2 (byref) and put result back into Var2 (byref) ; $ = Execute("$Var2ByRef = $Var1 + $Var2ByRef") ; do it ENDFUNCTION
Thanks,
Kent [ 10. December 2002, 08:58: Message edited by: kdyer ]
|