Software snipets for the Delphi & Pascal Community
Sep 05, 2010 - 05:13 AM
alt1
Borland :: Mailing Lists
alt1
Search  
alt1
alt1 alt1 alt1
alt1
Main Menu
alt1
· Home
· Your Account

Other Options

· AvantGo
· Downloads
· FAQ
· Members List
· Messages
· News
· Recommend Us
· Reviews
· Search
· Sections
· Stats
· Submit News
· Topics
· Top List
· Web Links

alt1
Who's online
alt1
There are currently, 4 guest(s) and 0 member(s) online.

You are an anonymous user. You can register for free by clicking here


alt1
alt1
Downloading all files (*.*) from within Delphi
Posted by: Gayle
alt1
Topic Internet & Web
You can use this code to download all files from an FTP site from within your Delphi program.


Uses WININET;

function TMyFtp.FindFiles: TStringList;
var
FindData: TWin32FindData;
FindHandle: HInternet;
Begin
FindHandle := FtpFindFirstFile(FFtphandle, '*.*',
FindData, 0, 0);
If FindHandle = nil Then
Begin
Result := nil;
Exit;
End;
FCurFiles.Clear;
FCurFiles.Add(GetFindDataStr(FindData));

While InternetFindnextFile(FindHandle, @FindData) Do
FCurFiles.Add(GetFindDataStr(FindData));
InternetCloseHandle(Findhandle);
GetCurrentDirectory;
Result := FCurFiles;
End;

function GetFindDataStr(FindData: TWin32FindData): string;

//Get current files in directory

var
S: string;
Temp: string;
Begin
S := S + GetDots(75);
Move(FindData.CFilename[0], S[6], StrLen(FindData.CFileName));
Temp := IntToStr(FindData.nFileSizeLow);
Move(Temp[1], S[25], Length(Temp));
Result := S;
End;

function TMyFtp.FindFiles: TStringList;
var
FindData: TWin32FindData;
FindHandle: HInternet;
Begin
FindHandle := FtpFindFirstFile(FFtphandle, '*.pjl',
FindData, 0, 0);

If FindHandle = nil then
Begin
Result := nil;
Exit;
end;

FCurFiles.Clear;
FCurFiles.Add(GetFindDataStr(FindData));

While InternetFindnextFile(FindHandle, @FindData) Do

FCurFiles.Add(GetFindDataStr(FindData));
InternetCloseHandle(Findhandle);
GetCurrentDirectory;
Result := FCurFiles;

End;

function TECU.GetFile(FTPFile, NewFile: string): Boolean;

//Download a File Through FTP

begin
Result := FtpGetFile(FFTPHandle, PChar(FTPFile), PChar(NewFile), False, File_Attribute_Normal, Ftp_Transfer_Type_Binary, 0);
end;

Procedure Button1.Onclick();
ar
MyHandle: HINTERNET; //handle from InternetConnect
Begin
MyHandle := InternetOpen(`ECU', 0, nil, 0, 0);
InternetConnect(MyHandle, .linksarray[0]., 0, Anonymouse, .linksarray[1]., INTERNET_SERVICE_FTP, INTERNET_CONNECT_FLAG_PASSIVE, 0 );

//Changes to a specific directory once connected
TECU.ChangeDirExact('ftp://ftp.mysite.com/downloads');
FindHandle := FtpFindFirstFile(FFtphandle, '*35L.PJL', FindData, 0, 0);

// If the directory is blank, then tell me about it. Else, download all.
If FindHandle = nil Then
Begin
Result := nil;
ShowMessage('The file was not able to be downloaded. Please Re-Try');
End

Else
TECU.GetFile('*.*', 'c:\*.*');
End;
End;


//The call InternetConnect Uses the following function ( included with WinInet ):

{*******************************************************************************
function InternetConnect(
hInet: HINTERNET; // Handle from InternetOpen
lpszServerName: PChar; // Server: i.e., www.borland.com
nServerPort: INTERNET_PORT; // Usually 0
lpszUsername: PChar; // usually anonymous
lpszPassword: PChar; // usually your email address
dwService: DWORD; // FTP, HTTP, or Gopher?
dwFlags: DWORD; // Usually 0
dwContext: DWORD): // User defined number for callback
HINTERNET; stdcall;

*******************************************************************************}




alt1
alt1
 
alt1
Login
alt1
Username

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like a theme manager, comments configuration and posting comments with your name.

alt1
Related links
alt1
· More about Internet & Web
· News by admin


Most read story in Internet & Web:
Downloading all files (*.*) from within Delphi


Printer friendly page  Send this story to a friend

"Downloading all files (*.*) from within Delphi" | Login/Create an account | 4 Comments
Threshold
Comments are owned by the poster. We aren't responsible for their content.
Re: Downloading all files (*.*) from within Delphi(Score: 0)
by Anonymous on Aug 10, 2009 - 08:34 AM
Greetings. Check our page with best informations: Small games, Miniclip games


[ Comments not allowed for anonymous users, please register ]

Re: Downloading all files (*.*) from within Delphi(Score: 0)
by Anonymous on Nov 12, 2009 - 08:47 AM
film des dessin anim porn, tr s poilues sous les bras , vid o sex hijab, sexe tv nymphos, actrices arabe nue, sexy clips amateur gratuit, blog video zoo sex, clip zoophilie video gratuite, girls bergamo bakeca, w w w youporn at, animal sex movies, enorme bite stream, ado nue hard, webcam porno crack, porno xx fr, femmes baisant avec cheval, sex filimi izlet bedava, yasmine sex streaming, recit femme zoophile , download video porno da red tube


[ Comments not allowed for anonymous users, please register ]

Re: Downloading all files (*.*) from within Delphi(Score: 0)
by Anonymous on Nov 29, 2009 - 10:47 AM
alg riesex, video porno gratis con cicciolina con i cavalli, www jeux de cheval com, sex donna incinta, comment fais ejaculer une famme, siti tipo redtube, galerie femmes porno, mec 50 ans viril et muscl nu en vid o, video de fille 14 16 porno, photo porno de petite filles mineur, vi ille mamie toute nue, porntube x, zoophilli, recherche femme tres gros clitoris , amandine version pornographique, video real xx porno, extraits videos gratuite de julia channel, extrait video pissing gratuit, estrait zoophilie femme et cheval, clip porno exterieur


[ Comments not allowed for anonymous users, please register ]

Re: Downloading all files (*.*) from within Delphi(Score: 0)
by Anonymous on Jan 24, 2010 - 11:30 AM
salope en lingerie red tube, film porno femme asia torrents, photo zoophi, lupaland free, vid o gratuites vieux avec jeunes, photo ma femme nue, incest famille dvd teen, asiatic fille masturbee video, youporn poursuites, gratuit vid os vieille avec gode sans mail


[ Comments not allowed for anonymous users, please register ]

alt1
Report Bugs :: Tasks :: Developers 
alt1




alt1