Dear all,

I am using BCB6 and ICS.  I reference The MailRcv application as a start of my 
new task.  It works fine as long as the Pop3Cli is created and used in the main 
GUI context.  For my app I need to do the POP3 mail client as a worker thread.  
However it does not work as the event Pop3ClientRequestDone can never be 
triggered.  The symptom is that after calling Connect(), a call to User() 
throws exception as it is in pop3DnsLookupState.

I suspect that this is caused by the lack of a message queue in the worker 
thread.

As such I try to create a message loop using the ConApp.pas as an example:

void __fastcall TMailClientThread::MessageLoop(void)
{
  TMsg *pMsg;

  while(!Terminated && GetMessage(pMsg, 0, 0, 0))
  {
     TranslateMessage(pMsg);
     DispatchMessage(pMsg);
  }
}

void __fastcall TMailClientThread::Execute()
{
  this->MessageLoop();

  //---- Place thread code here ----
  while(!Terminated)
  {
     :
     :
  }
}

However the thread execution will not proceed as the TranslateMessage and 
DispatchMessage will not be reached in the while() within the MessageLoop 
function call.

Is there any ICS sample that instructs how to implement a message queue in a 
threaded application?

If I am wrong in the above understanding please kindly advise.  I will be happy 
if there is indeed a simpler solution.

Thanks in advance.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to