Page 1 of 2
FTP-directory
Posted: Fri Aug 10, 2007 2:35 pm
by Dietmar Jahnel
I'm trying to read the files from a ftp-server.
I modified the ftpdir-sample and always get "oFTP:hFTP is null"
both oInternet:hWinINet and oInternet:hSession are empty
Am I doing something wrong or is it a Vista-related problem?
Many thanks for help,
Dietmar
function Main()
local oInternet := TInternet():New()
// local oFTP := TFTP():New( "207.46.133.140", oInternet ) //
local oFTP := TFTP():New( "
ftp://ftp.ourserver.at/", oInternet )
local aFiles
if ! Empty( oFTP:hFTP )
aFiles = oFTP:Directory( "*.*" )
AEval( aFiles, { | aFile | MsgInfo( aFile[ 1 ] ) } )
else
MsgAlert( "oFTP:hFTP is null" )
endif
oInternet:End()
MsgInfo( "Done!" )
return nil
Posted: Fri Aug 10, 2007 9:06 pm
by Antonio Linares
Dietmar,
Just change this line in your code and its working fine (tested on Vista):
local oFTP := TFTP():New( "ftp.microsoft.com", oInternet )
Posted: Mon Aug 13, 2007 12:32 pm
by Dietmar Jahnel
Antonio,
I tried this sample on two PCs - the result is always "oFTP:hFTP is null"
How can I find out what the problem is?
Thanks (again) for help,
Dietmar
Posted: Mon Aug 13, 2007 12:58 pm
by Antonio Linares
Dietmar,
Can you connect to ftp.microsoft.com from the Internet Explorer ?
Posted: Mon Aug 13, 2007 2:45 pm
by Dietmar Jahnel
yes I can connect to
ftp://ftp.microsoft.com/ from Internet Explorer.
Dietmar
Posted: Mon Aug 13, 2007 4:55 pm
by Antonio Linares
Dietmar,
Here I run Vista as Administrator, please try it as Administrator to see if that makes a difference, thanks
Posted: Mon Aug 13, 2007 6:31 pm
by Dietmar Jahnel
It does not make a difference.
I tried on a PC with WindowsXP in a different environment - same result.
I built the sample with xHB RC16 and FWH 7.05
On my vistaPCs its only me with all the rights possible.
Must be something else...
Posted: Mon Aug 13, 2007 10:32 pm
by Antonio Linares
Dietmar,
I email you my EXE built using FWH 7.07 and Borland. Please try it there, thanks
Posted: Mon Aug 13, 2007 11:06 pm
by James Bott
I am getting the message "oFTP:hFTP is null" here too (actually oFTP:hFTP is equal to zero). I am using FWH 7.05, Borland, and XP Pro SP2. I have administrator rights.
James
Posted: Tue Aug 14, 2007 6:50 am
by Dietmar Jahnel
Antonio,
your exe is working here as well!
any idea how to solve the problem?
Thank,
Dietmar
Posted: Tue Aug 14, 2007 8:10 am
by Antonio Linares
James,
Please try it with FWH 7.07, thanks
Posted: Tue Aug 14, 2007 8:39 am
by Antonio Linares
Dietmar,
Solved. Try it this way:
Code: Select all
#include "FiveWin.ch"
function Main()
local oInternet := TInternet():New()
local oFTP := TFTP():New( "ftp.microsoft.com", oInternet )
local aFiles
if ! Empty( oFTP:hFTP )
aFiles = oFTP:Directory( "*.*" )
AEval( aFiles, { | aFile | MsgInfo( aFile[ 1 ] ) } )
else
MsgAlert( "oFTP:hFTP is null" )
endif
oInternet:End()
MsgInfo( "Done!" )
return nil
DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
n4 AS DWORD ) AS LONG PASCAL ;
FROM "InternetOpenA" LIB "wininet.dll"
Posted: Tue Aug 14, 2007 9:42 am
by Dietmar Jahnel
now it' working fine!
many thanks!
Posted: Tue Aug 14, 2007 9:50 am
by Antonio Linares
glad to know its fine
Posted: Tue Aug 14, 2007 10:28 am
by Dietmar Jahnel
Sorry, but now I have another problem:
I need to read the file name and put it in a text file using:
Code: Select all
oText := TTxtFile():New( datei )
FOR x = 1 to len(aSpringer)
oText:Add(aSpringer[x,1])
NEXT
that' s the result:
JBl_E-2006-643-647-VfGH.pdf ÿÿÿÿ ¸ò ˜ò œò ´ò , ò à“" ø“" è ØÝ ØÝ I " "\à P‘ @} N N EEEE T R O O N N N I C SS
230-N NN E T R O O N NN I C
JBl_E-2006-647-649-OGH.pdf i o n D y n a m i c F a l s e ] 3 ' &Uà ›
w™Þ™
T R U S C : \ P ewt’ t’
JBl_E-2006-649-653-OGH.pdf 7-144-Novÿ ûDî Ä P‘ 09:10AM 83386 JBl-2000-145-151-Winkler.pdf
05-02-07 09:10AM 123366 JBl-2000-152-161-Taupitz.pdf
05-02-07 09:10AM 153878 JBl-2000-16-30-Schima.pdf
05-02-07 09
I found some posts about this extra informations, but no solution...
Dietmar