Board index » cppbuilder » Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Turbo C++ Explorer: FTP components? Indy? NM? - Help closes


2006-12-25 08:26:12 AM
cppbuilder29
Does Turbo C++ Explorer come with any FTP components? I can't find them.
Also the Help opens and closes very fast when I request help about a function in the editor. Is this a bug? It takes me to the Topic Found window and then when I select a topic the help pops open and then it closes fast, no time to read anything. Any patches for this? I re-installed and it didn't help.
TIA,
DJ
 
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Does Turbo C++ Explorer come with any FTP
components? I can't find them.
Also the Help opens and closes very fast when I
request help about a function in the editor. Is this
a bug? It takes me to the Topic Found window
and then when I select a topic the help pops
open and then it closes fast, no time to read
anything. Any patches for this? I re-installed and
it didn't help.
TIA,
DJ
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Quote
Does Turbo C++ Explorer come with any FTP
components? I can't find them.

FTP components in BDS/C++Builder are facilitatied by a third party and hence
are not included in the Explorer edition. You'll need Turbo C++ Pro/BDS Pro+
for that,
Quote
Also the Help opens and closes very fast when I
request help about a function in the editor. Is this
a bug? It takes me to the Topic Found window
and then when I select a topic the help pops
open and then it closes fast, no time to read
anything. Any patches for this? I re-installed and
it didn't help.

Press <Ctrl>+<F1>for context sensitive help. For just browsing the help
documents, click the help button
 

{smallsort}

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Jennifer-Ashley wrote:
Quote
>Does Turbo C++ Explorer come with any FTP
>components? I can't find them.
>
FTP components in BDS/C++Builder are facilitatied by a third party and hence
are not included in the Explorer edition. You'll need Turbo C++ Pro/BDS Pro+
for that,
That is not true. Explorer edition does have indy components. They are
just not visible in the IDE components toolbar.
To use them you will have to add ${BDS}\include\indy9 to the list of
include folders and instantiate components in form's constructor.
Something like this:
//Unit1.h:
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <IdComponent.hpp>
#include <Idtcpserver.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
TIdTCPServer *myTcpServer;
void __fastcall OnTIdServerConnect(TIdPeerThread* AThread);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//Unitt1.cpp
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
myTcpServer = new TIdTCPServer(this);
myTcpServer->OnConnect = OnTIdServerConnect;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnTIdServerConnect(TIdPeerThread* AThread) {
}
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

"Jennifer-Ashley" < XXXX@XXXXX.COM >wrote:
Quote
Press <Ctrl>+<F1>for context sensitive help. For just browsing the help
documents, click the help button
I did try Ctrl + F1 and it brings up the
Topics Found window. But when I click in
that window the topic I want it finds the
topic, it presents it for about a second and
then the help window closes fast by itself giving
me no time to read anything there.
Now the regular help does work, but no luck
if I use Ctrl + F1 in the editor.
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

DJ wrote:
Quote
Does Turbo C++ Explorer come with any FTP
components? I can't find them.
In addition to Indy9, you can use the WinAPI found in wininet.h
InternetGoOnline
InternetOpen
InternetConnect
FtpGetCurrentDirectory
FtpFindFirstFile
FtpGetFile
FtpPutFile
FindClose
InternetCloseHandle
And those are just the ones I actually use.
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Quote
That is not true. Explorer edition does have indy components. They are
just not visible in the IDE components toolbar.
To use them you will have to add ${BDS}\include\indy9 to the
I get this linker Error.
[Linker Error] Error: Unresolved external
'Idtcpserver::TIdTCPServer::' referenced from
D:\DATA\BORLAND STUDIO PROJECTS\AGTEST1
\DEBUG_BUILD\UNIT1.OBJ
[Linker Error] Error: Unresolved external '__fastcall
Idtcpserver::TIdTCPServer::TIdTCPServer
(Classes::TComponent *)' referenced from D:\DATA\BORLAND
STUDIO PROJECTS\AGTEST1\DEBUG_BUILD\UNIT1.OBJ
[Linker Error] Error: Unresolved external '__fastcall
TForm1::OnTIdServerConnect(Idtcpserver::TIdPeerThread *)'
referenced from D:\DATA\BORLAND STUDIO
PROJECTS\AGTEST1\DEBUG_BUILD\UNIT1.OBJ
Could you post a simple FTP project example?
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Could you post a simple example on how to put/get
a file in/from a website?
Thanks.
Bob Gonder < XXXX@XXXXX.COM >wrote:
Quote
DJ wrote:

>Does Turbo C++ Explorer come with any FTP
>components? I can't find them.

In addition to Indy9, you can use the WinAPI found in wininet.h

InternetGoOnline
InternetOpen
InternetConnect
FtpGetCurrentDirectory
FtpFindFirstFile
FtpGetFile
FtpPutFile
FindClose
InternetCloseHandle

And those are just the ones I actually use.


 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

DJ wrote:
Quote
>That is not true. Explorer edition does have indy components. They are
>just not visible in the IDE components toolbar.
>To use them you will have to add ${BDS}\include\indy9 to the


I get this linker Error.
OK what is missing is the bpi file that links indy libraries to the
project. Just open project properties and go to packages and in the line
that lists all the packages included add "indy" at the end separated
with ";" so it wil look like this:
vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;bdertl;vcldbx;indy
As for ftp just add this as a include in your header:
#include <IdFTP.hpp>
And declare member variable of class TIdFTP. You know the rest.
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

DJ wrote:
Quote
Could you post a simple example on how to put/get
a file in/from a website?
HINTERNET hInternetSession;
HINTERNET hFTPSession;
static char ftp[]= "ftp.myisp.com";
static char name[]="my_isp_knows_me_as";
static char password[]="my_isp_password";
static char get_from[] = "updates\\UpdateFile.exe";
static char get_to[] = "C:\\UpdateFile.exe";
static char* send_from = to; // swap to send it back
static char* send_to = from;
hInternetSession = InternetOpen(
"TheNameOfThisApp.exe",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0 );
hFTPSession = InternetConnect(
hInternetSession,
ftp, // Server we wish to connect to.
INTERNET_INVALID_PORT_NUMBER,
name, // Username, can be NULL.
password, // Password, can be NULL.
INTERNET_SERVICE_FTP
0, (DWORD)0 );
WIN32_FIND_DATA FindFrom;
HANDLE ff;
/* you can bypass the find() if you know you want to download the
file. I check the file date to see if I want to bother downloading it.
*/
ff = FtpFindFirstFile( hFTPSession, get_from, &FindFrom,
INTERNET_FLAG_RELOAD, NULL );
if( ff ){
FtpGetFile( hFTPSession,
get_from, get_to,
FALSE,
FILE_ATTRIBUTE_NORMAL,
FTP_TRANSFER_TYPE_BINARY, 0 );
FtpPutFile( hFTPSession,
send_from, send_to,
FTP_TRANSFER_TYPE_BINARY, 0 );
InternetCloseHandle( ff );
};
InternetCloseHandle( hFTPSession );
InternetCloseHandle( hInternetSession );
And there you have it.
Really simple.
Error checking, of course adds to the complexity,
as does figuring file names, checking dates, and so on.
These functions don't return until the file has completed, or
aborted.There are additional functions available that I haven't
explored, that allow you to give feedback on the transfer progress.
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Thanks Bob! I'll play around with that.
msdn2.microsoft.com/en-us/library/aa385473.aspx
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

Darko Miletic < XXXX@XXXXX.COM >wrote:
Quote
OK what is missing is the bpi file that links indy libraries to the
project. Just open project properties and go to packages and in the line
that lists all the packages included add "indy" at the end separated
with ";" so it wil look like this:

vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;bdertl;vcldbx;indy

Thanks Darko. That took care of
the problem. Now I don't know if I
should go Indy or WinINet.
Pros and Cons?
Do I need to distribute any thing else with the EXE?
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

DJ wrote:
Quote
Thanks Darko. That took care of
the problem. Now I don't know if I
should go Indy or WinINet.

Pros and Cons?
It does not matter really. It is more a matter of personal choice.
Quote

Do I need to distribute any thing else with the EXE?


That depends. If you build your exe with dynamic packages than you need
to distribute all bpl files you use, on the other hand if you link
everything in exe than no distribution hassle.
 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

do you know if these ftp functions use PASV? I have to use PASV.
Bob Gonder wrote:
Quote
DJ wrote:

>Could you post a simple example on how to put/get
>a file in/from a website?

HINTERNET hInternetSession;
HINTERNET hFTPSession;
static char ftp[]= "ftp.myisp.com";
static char name[]="my_isp_knows_me_as";
static char password[]="my_isp_password";
static char get_from[] = "updates\\UpdateFile.exe";
static char get_to[] = "C:\\UpdateFile.exe";
static char* send_from = to; // swap to send it back
static char* send_to = from;

hInternetSession = InternetOpen(
"TheNameOfThisApp.exe",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0 );
hFTPSession = InternetConnect(
hInternetSession,
ftp, // Server we wish to connect to.
INTERNET_INVALID_PORT_NUMBER,
name, // Username, can be NULL.
password, // Password, can be NULL.
INTERNET_SERVICE_FTP
0, (DWORD)0 );

WIN32_FIND_DATA FindFrom;
HANDLE ff;
/* you can bypass the find() if you know you want to download the
file. I check the file date to see if I want to bother downloading it.
*/
ff = FtpFindFirstFile( hFTPSession, get_from, &FindFrom,
INTERNET_FLAG_RELOAD, NULL );
if( ff ){
FtpGetFile( hFTPSession,
get_from, get_to,
FALSE,
FILE_ATTRIBUTE_NORMAL,
FTP_TRANSFER_TYPE_BINARY, 0 );
FtpPutFile( hFTPSession,
send_from, send_to,
FTP_TRANSFER_TYPE_BINARY, 0 );
InternetCloseHandle( ff );
};
InternetCloseHandle( hFTPSession );
InternetCloseHandle( hInternetSession );

And there you have it.
Really simple.
Error checking, of course adds to the complexity,
as does figuring file names, checking dates, and so on.
These functions don't return until the file has completed, or
aborted.There are additional functions available that I haven't
explored, that allow you to give feedback on the transfer progress.


 

Re:Turbo C++ Explorer: FTP components? Indy? NM? - Help closes

One nice thing about the indy component is the onprogress event. do
these function provide a way to update the user on progress? Thanks
Bob Gonder wrote:
Quote
DJ wrote:

>Could you post a simple example on how to put/get
>a file in/from a website?

HINTERNET hInternetSession;
HINTERNET hFTPSession;
static char ftp[]= "ftp.myisp.com";
static char name[]="my_isp_knows_me_as";
static char password[]="my_isp_password";
static char get_from[] = "updates\\UpdateFile.exe";
static char get_to[] = "C:\\UpdateFile.exe";
static char* send_from = to; // swap to send it back
static char* send_to = from;

hInternetSession = InternetOpen(
"TheNameOfThisApp.exe",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0 );
hFTPSession = InternetConnect(
hInternetSession,
ftp, // Server we wish to connect to.
INTERNET_INVALID_PORT_NUMBER,
name, // Username, can be NULL.
password, // Password, can be NULL.
INTERNET_SERVICE_FTP
0, (DWORD)0 );

WIN32_FIND_DATA FindFrom;
HANDLE ff;
/* you can bypass the find() if you know you want to download the
file. I check the file date to see if I want to bother downloading it.
*/
ff = FtpFindFirstFile( hFTPSession, get_from, &FindFrom,
INTERNET_FLAG_RELOAD, NULL );
if( ff ){
FtpGetFile( hFTPSession,
get_from, get_to,
FALSE,
FILE_ATTRIBUTE_NORMAL,
FTP_TRANSFER_TYPE_BINARY, 0 );
FtpPutFile( hFTPSession,
send_from, send_to,
FTP_TRANSFER_TYPE_BINARY, 0 );
InternetCloseHandle( ff );
};
InternetCloseHandle( hFTPSession );
InternetCloseHandle( hInternetSession );

And there you have it.
Really simple.
Error checking, of course adds to the complexity,
as does figuring file names, checking dates, and so on.
These functions don't return until the file has completed, or
aborted.There are additional functions available that I haven't
explored, that allow you to give feedback on the transfer progress.