Board index » cppbuilder » Synchronize in Indy TIdThread

Synchronize in Indy TIdThread


2005-03-03 01:13:29 AM
cppbuilder100
I am a bit worry : I used Synchronize() in a TThread without problems : I
defined the
procedure inside my specific TThread class and there were no problems .
Now I do the same inside a TIdThread ( I saw some documentation: all seem to
allow it in the same way:
another chance is the syncronization class but I ' d prefer the same way.. )
but I get the error :
[C++ Error] Unit11.cpp(105): E2285 Could not find a match for
'TIdBaseThread::Synchronize(void)'
many thanks if you can help me
ciao
Roberto
This is my code... (actually)
class TSMTPThread : public TIdThread
{
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // must be 0x1000
LPCSTR szName; // pointer to name (in user addr space)
DWORD dwThreadID; // thread ID (-1=caller thread)
DWORD dwFlags; // reserved for future use, must be zero
} THREADNAME_INFO;
private:
TIdMessage *MyMsg; // Message and server SMTP encapsuled
// into the thread
TIdSMTP *MyIdSMTP1;
protected:
void __fastcall Run();
public:
__fastcall TSMTPThread(bool CreateSuspended);
void __fastcall Read_Edit_indirizzo_mail(void);
AnsiString MessageText,temps;
AnsiString FFrom;
AnsiString FMessage;
AnsiString FRecipient;
AnsiString FSMTPServer;
AnsiString FSubject;
};
void __fastcall TSMTPThread::Read_Edit_indirizzo_mail(void)
{
temps = timeinfo[turno_attuale-1].Edit_indirizzo_mail->Text;
}
void __fastcall TSMTPThread::Run()
{
//@@@ Run e' eseguito CONTINUAMENTE finche' non c'e' una unhandled
exception)
if( sendmail_flag == true)
{
try{ // si tenta il setup del modulo
TDIMessage
MyMsg->Clear();
MyMsg->CharSet = "Windows-1251";
/* ALL to synchronize...
MyMsg->From->Name = Form13->Edit1->Text;
MyMsg->From->Address = Form13->Edit2->Text;
MyMsg->Sender->Name = Form13->Edit3->Text;
MyMsg->Sender->Address = Form13->Edit4->Text;
*/
// first try :
Synchronize(Read_Edit_indirizzo_mail); //<--!!!!!
compilation ERROR
(...........)
 
 

Re:Synchronize in Indy TIdThread

you can try commeting the following line on IdThread.hpp
HIDESBASE void __fastcall Synchronize(const System::TMethod &Method)/*
overload */;
"Roberto Zais" < XXXX@XXXXX.COM >wrote in message
Quote
I am a bit worry : I used Synchronize() in a TThread without problems : I
defined the
procedure inside my specific TThread class and there were no problems .
Now I do the same inside a TIdThread ( I saw some documentation: all seem
to
allow it in the same way:
another chance is the syncronization class but I ' d prefer the same
way.. )
but I get the error :


[C++ Error] Unit11.cpp(105): E2285 Could not find a match for
'TIdBaseThread::Synchronize(void)'

many thanks if you can help me
ciao
Roberto

This is my code... (actually)


class TSMTPThread : public TIdThread
{
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // must be 0x1000
LPCSTR szName; // pointer to name (in user addr space)
DWORD dwThreadID; // thread ID (-1=caller thread)
DWORD dwFlags; // reserved for future use, must be zero
} THREADNAME_INFO;
private:
TIdMessage *MyMsg; // Message and server SMTP encapsuled
// into the thread
TIdSMTP *MyIdSMTP1;


protected:
void __fastcall Run();
public:
__fastcall TSMTPThread(bool CreateSuspended);
void __fastcall Read_Edit_indirizzo_mail(void);

AnsiString MessageText,temps;
AnsiString FFrom;
AnsiString FMessage;
AnsiString FRecipient;
AnsiString FSMTPServer;
AnsiString FSubject;
};

void __fastcall TSMTPThread::Read_Edit_indirizzo_mail(void)
{
temps = timeinfo[turno_attuale-1].Edit_indirizzo_mail->Text;
}

void __fastcall TSMTPThread::Run()
{
//@@@ Run e' eseguito CONTINUAMENTE finche' non c'e' una unhandled
exception)

if( sendmail_flag == true)
{
try{ // si tenta il setup del modulo
TDIMessage

MyMsg->Clear();
MyMsg->CharSet = "Windows-1251";
/* ALL to synchronize...
MyMsg->From->Name = Form13->Edit1->Text;
MyMsg->From->Address = Form13->Edit2->Text;
MyMsg->Sender->Name = Form13->Edit3->Text;
MyMsg->Sender->Address = Form13->Edit4->Text;
*/
// first try :
Synchronize(Read_Edit_indirizzo_mail); //<--!!!!!
compilation ERROR
(...........)



 

Re:Synchronize in Indy TIdThread

Ok, it works fine !
Thanks a lot!
Roberto
"Omar E. Zelaya" < XXXX@XXXXX.COM >ha scritto nel messaggio
Quote
you can try commeting the following line on IdThread.hpp
HIDESBASE void __fastcall Synchronize(const System::TMethod &Method)/*
overload */;

"Roberto Zais" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>I am a bit worry : I used Synchronize() in a TThread without problems :
I
>defined the
>procedure inside my specific TThread class and there were no problems .
>Now I do the same inside a TIdThread ( I saw some documentation: all
seem
>to
>allow it in the same way:
>another chance is the syncronization class but I ' d prefer the same
>way.. )
>but I get the error :
>
>
>[C++ Error] Unit11.cpp(105): E2285 Could not find a match for
>'TIdBaseThread::Synchronize(void)'
>
>many thanks if you can help me
>ciao
>Roberto
>
>This is my code... (actually)
>
>
>class TSMTPThread : public TIdThread
>{
>typedef struct tagTHREADNAME_INFO
>{
>DWORD dwType; // must be 0x1000
>LPCSTR szName; // pointer to name (in user addr space)
>DWORD dwThreadID; // thread ID (-1=caller thread)
>DWORD dwFlags; // reserved for future use, must be zero
>} THREADNAME_INFO;
>private:
>TIdMessage *MyMsg; // Message and server SMTP encapsuled
>// into the thread
>TIdSMTP *MyIdSMTP1;
>
>
>protected:
>void __fastcall Run();
>public:
>__fastcall TSMTPThread(bool CreateSuspended);
>void __fastcall Read_Edit_indirizzo_mail(void);
>
>AnsiString MessageText,temps;
>AnsiString FFrom;
>AnsiString FMessage;
>AnsiString FRecipient;
>AnsiString FSMTPServer;
>AnsiString FSubject;
>};
>
>void __fastcall TSMTPThread::Read_Edit_indirizzo_mail(void)
>{
>temps = timeinfo[turno_attuale-1].Edit_indirizzo_mail->Text;
>}
>
>void __fastcall TSMTPThread::Run()
>{
>//@@@ Run e' eseguito CONTINUAMENTE finche' non c'e' una unhandled
>exception)
>
>if( sendmail_flag == true)
>{
>try{ // si tenta il setup del modulo
>TDIMessage
>
>MyMsg->Clear();
>MyMsg->CharSet = "Windows-1251";
>/* ALL to synchronize...
>MyMsg->From->Name = Form13->Edit1->Text;
>MyMsg->From->Address = Form13->Edit2->Text;
>MyMsg->Sender->Name = Form13->Edit3->Text;
>MyMsg->Sender->Address = Form13->Edit4->Text;
>*/
>// first try :
>Synchronize(Read_Edit_indirizzo_mail); //<--!!!!!
>compilation ERROR
>(...........)
>
>
>


 

{smallsort}