Re: [twsocket] Using FTPClient in dll

2010-12-01 Thread Busai Péter

2010.12.01. 7:07 keltezéssel, Arno Garrels írta:


That's true, you should not call ProcessMessages in a loop like
above. NOFORMS and MessageLoop should work. Otherwise show us some
more of your code.


Again you are right. NOFORMS is the key.
The below comment from OverbyteIcsDll1.dpr was a bit misleading.
{$DEFINE NOFORMS}   // This will avoid forms unit and reduce DLL size
I deleted that line because I knew I have to use forms unit in one of my 
units.

Now I see that it is explained in wsocket.pas history.

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


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Busai Péter

Solved.




Hi!

I have to write a dll which downloads some file.
I created a project using example OverbyteIcsDll2.dpr as a sample.
There are 2 differences. I must put a form inside the dll, which is just
a user interface to set up and save connection parameters, but this form
is not
created at the time of transfer. So NOFORMS is not defined.
The other difference is that I create a datamodule in the thread, and
ftpcli is created inside that module.
I use async methods.
It is started from a method of datamodule:
   FTPCli.OpenAsync;
   FTPCli.MessageLoop;

The transfer is working fine.
The problem is, when OnSessionClosed is fired, PostMessage sends WM_QUIT
to FTPCli.Handle* but MessageLoop does not exit.

* Also tried FtpCli.ControlSocket.Handle and FtpCli.WndHandler.Handle

What am I missing?
Thank in advance.

Peter


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


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Arno Garrels
Busai Péter wrote:
 Solved.

That's great, please describe briefly the cause of the problem
and how it was solved, readers of this list might benefit from
your findings and save some time.

-- 
Arno Garrels


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


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Busai Péter



Solved.

That's great, please describe briefly the cause of the problem
and how it was solved, readers of this list might benefit from
your findings and save some time.



Well, I do not clearly understand the internals, but defining NOFORMS in 
project option

and  using
while not FTPCli.Terminated do
  FTPCli.ProcessMessages;

instead of

  FTPCli.MessageLoop

and quitting with FTPCli.PostQuitMessage did work.

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


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Arno Garrels
Busai Péter wrote:
 Solved.
 That's great, please describe briefly the cause of the problem
 and how it was solved, readers of this list might benefit from
 your findings and save some time.
 
 
 Well, I do not clearly understand the internals, but defining NOFORMS
 in project option
 and  using
 while not FTPCli.Terminated do
   FTPCli.ProcessMessages;
 
 instead of
 
   FTPCli.MessageLoop
 
 and quitting with FTPCli.PostQuitMessage did work.

You must be using some current ICS version. That's positive 
feedback! PostQuitMessage was introduced recently to ease quit
of the message loop.

-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Busai Péter



2010.11.30. 20:41 keltezéssel, Arno Garrels írta:



Well, I do not clearly understand the internals, but defining NOFORMS
in project option
and  using
 while not FTPCli.Terminated do
   FTPCli.ProcessMessages;

instead of

   FTPCli.MessageLoop

and quitting with FTPCli.PostQuitMessage did work.

You must be using some current ICS version. That's positive
feedback! PostQuitMessage was introduced recently to ease quit
of the message loop.


My first thing was to update from svn ;)
However I think the above design not very nice, since CPU is on 100% 
while transfer is taking place.


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


Re: [twsocket] Using FTPClient in dll

2010-11-30 Thread Arno Garrels
Busai Péter wrote:
 2010.11.30. 20:41 keltezéssel, Arno Garrels írta:
 
 Well, I do not clearly understand the internals, but defining
 NOFORMS in project option
 and  using
  while not FTPCli.Terminated do
FTPCli.ProcessMessages;
 
 instead of
 
FTPCli.MessageLoop
 
 and quitting with FTPCli.PostQuitMessage did work.
 You must be using some current ICS version. That's positive
 feedback! PostQuitMessage was introduced recently to ease quit
 of the message loop.
 
 My first thing was to update from svn ;)
 However I think the above design not very nice, since CPU is on 100%
 while transfer is taking place.

That's true, you should not call ProcessMessages in a loop like
above. NOFORMS and MessageLoop should work. Otherwise show us some
more of your code.
  
-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be