Re: [twsocket] Using TPop3Cli (begin in TWSocket Digest, Vol 127, Issue 9)

2005-08-06 Thread Francois PIETTE
> I have some questions:
>
> I need DLL like 'AllInOne', how I must organize it? I have 2 problems:
>
> 1.There is one function entry point in DLL. How can I detect what
> OnRequestDone complit session and I can return from DLL funciton?
>
> 2.And how I must free memory under TPop3Cli after RqType==smtpQuit
> in OnRequestDone? (before returning from DLL)

The problem with a DLL is that you don't know the hosting application.
For ICS component to work properly, you need to have a working message pump. 
If the DLL is used from a GUI application, in the main thread, there is a 
message pump. If the DLL is called from a console mode application, it is 
likely that there is no such message pump.

So to have your DLL work in all situation, you should put all ICS stuff into 
a worker thread within the DLL and give this thread a message pump.

The function your DLL export would create the thread as paused, pass all 
parameters to the thread, resume the thread and wait until the thread 
terminate. The thread would handle everything.

ICS has a sample DLL to demonstrate this. Have a look at IcsDll1.dpr you'll 
find in your ics\internet directory. This sample use a simple socket, but 
there is no difference with POP3 you are interested in.

--
[EMAIL PROTECTED]
http://www.overbyte.be

-- 
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


[twsocket] Using TPop3Cli (begin in TWSocket Digest, Vol 127, Issue 9)

2005-08-06 Thread Dmitry Andreev

Hello!
I have some questions:

I need DLL like 'AllInOne', how I must organize it? I have 2 problems:

1.There is one function entry point in DLL. How can I detect what OnRequestDone 
complit session and I can return from DLL funciton?

2.And how I must free memory under TPop3Cli after RqType==smtpQuit in 
OnRequestDone? (before returning from DLL)

Thank.
Best regards.

-- 
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


Re: [twsocket] Using TPop3Cli

2005-07-30 Thread Francois PIETTE
> Pop3Cli->Connect();
> WaitForSingleObject(hEvent,Pop3TimeOut);

> What I doing wrong?

WaitForSingleObject is a blocking function that prevent any event from being 
triggered (you can see that your application is frozen: you cna't click on a 
button or resize it). So ICS component - which are event driven - do not 
work.

Instead of "waiting", just use the event OnRequestDone that is triggered 
when the asynchronous operation you requested has been executed in the 
background. See MailRcv sample program. Also have a look at MailSnd (which 
is about SMTP) to see the code behind "All in one" button that chain asynch 
operations.
--
[EMAIL PROTECTED]
http://www.overbyte.be



- Original Message - 
From: "??? ???" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, July 30, 2005 5:01 PM
Subject: [twsocket] Using TPop3Cli


>
> Hello,
> I try using TPop3Cli.
> Code like this don`t working:
>
> void MyProc()
> {
> ...
> Pop3Cli->Connect();
> WaitForSingleObject(hEvent,Pop3TimeOut);
> Pop3Cli->User();
> WaitForSingleObject(hEvent,Pop3TimeOut);
> Pop3Cli->Pass();
> WaitForSingleObject(hEvent,Pop3TimeOut);
> ...
> }
>
> void __fastcall TForm1::Pop3Cli1RequestDone(TObject *Sender,
>  TPop3Request RqType, WORD Error)
> {
> SetEvent(hEvent);
> }
>
> What I doing wrong?
> Or how I will use TPop3Cli? Before I was using TSyncPop3Cli and code like 
> this worked OK:
> ...
> SyncPop3->ConnectSync();
> SyncPop3->UserSync();
> SyncPop3->PassSync();
> ...
>
>
> Thank.
> Best regards!
>
>
>
> -- 
> 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
> 

-- 
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


Re: [twsocket] Using TPop3Cli

2005-07-30 Thread Wilfried Mestdagh
Hello Äìèòðèé,

You have to do next action in OnRequestDone. TPop3Cli is asynchronous
doing the work in background while your application can go on with other
things to do. Just do a switch (RqType) in the requestdone for the next
action. No need for all that sequentinal progrmming :)

---
Rgds, Wilfried
http://www.mestdagh.biz

Saturday, July 30, 2005, 17:01, Äìèòðèé Àíäðååâ wrote:


> Hello,
> I try using TPop3Cli.
> Code like this don`t working:

> void MyProc()
> {
> ...
Pop3Cli->>Connect();
> WaitForSingleObject(hEvent,Pop3TimeOut);
Pop3Cli->>User();
> WaitForSingleObject(hEvent,Pop3TimeOut);
Pop3Cli->>Pass();
> WaitForSingleObject(hEvent,Pop3TimeOut);
> ...
> }

> void __fastcall TForm1::Pop3Cli1RequestDone(TObject *Sender,
>   TPop3Request RqType, WORD Error)
> {
> SetEvent(hEvent);
> }

> What I doing wrong?
> Or how I will use TPop3Cli? Before I was using TSyncPop3Cli and code like 
> this worked OK:
> ...
SyncPop3->>ConnectSync();
SyncPop3->>UserSync();
SyncPop3->>PassSync();
> ...


> Thank.
> Best regards!




-- 
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


[twsocket] Using TPop3Cli

2005-07-30 Thread Дмитрий Андреев

Hello,
I try using TPop3Cli.
Code like this don`t working:

void MyProc()
{
...
Pop3Cli->Connect();
WaitForSingleObject(hEvent,Pop3TimeOut);
Pop3Cli->User();
WaitForSingleObject(hEvent,Pop3TimeOut);
Pop3Cli->Pass();
WaitForSingleObject(hEvent,Pop3TimeOut);
...
}

void __fastcall TForm1::Pop3Cli1RequestDone(TObject *Sender,
  TPop3Request RqType, WORD Error)
{
SetEvent(hEvent);
}

What I doing wrong?
Or how I will use TPop3Cli? Before I was using TSyncPop3Cli and code like this 
worked OK:
...
SyncPop3->ConnectSync();
SyncPop3->UserSync();
SyncPop3->PassSync();
...


Thank.
Best regards!



-- 
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