Re: [twsocket] ReadLine

2005-05-02 Thread Francois Piette
  You _always_ need a message pump. If the calling program doesn't provide
  one, you must provide one and to have one without interfering with the
  calling DLL it is better to have all you stuff in a thread. Consider a
  thread as a program within a program.

  If you don't want to have a thread, you must ask the host application to
  provide a hook for Application.ProcessMessages (or equivalent if the host
  application is written using another language). You can do that by using a
  callback.

 Hm, could that message pump be realised by a timer in the dll where the
 application.processmessages is called each onTimer event?

Defenitely not. Depending on the network traffic, you could easily have 
something like one thousand
messages per second in the queue. The message loop must run full speed.

As I said, you must either provide a callback to the DLL to call the 
application's message pump, or
have you own thread with his own message queue and message pump (easier).
--
[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


Re: [twsocket] ReadLine

2005-05-02 Thread Angus Robertson - Magenta Systems Ltd
 Hm, could that message pump be realised by a timer in the dll where the
 application.processmessages is called each onTimer event?

You can not use a TTimer since that uses windows messages and thus 
needs the message loop.  But you can use the windows SetTimer API with 
a callback.  I use such a timer to close a database in a DLL. 

Angus


procedure TimerProc (Wnd: HWnd; Msg: Integer; Id: Integer;

CurrentTime: DWord) ; stdcall ;
begin
   SetTimerEnabled (false) ;
   doDBClose ;
end;

procedure SetTimerEnabled (const Value: Boolean);
begin
if TimerEnabled = Value then Exit;
if Value then
begin
TimerHandle := SetTimer (0, 0, TimerInterval, @TimerProc) ;
end
else
begin
if TimerHandle  0 then
begin
KillTimer (0, TimerHandle) ;
   TimerHandle := 0 ;
end;
end;
TimerEnabled := Value;
end;


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

2005-05-02 Thread Markus Humm
Francois Piette schrieb:
 
 
 Defenitely not. Depending on the network traffic, you could easily have 
 something like one thousand
 messages per second in the queue. The message loop must run full speed.
 
 As I said, you must either provide a callback to the DLL to call the 
 application's message pump, or
 have you own thread with his own message queue and message pump (easier).

Okay, timer doesn't work for another reason: the timer component needs
messages itsself so doesn't fire.

Setting up a thread and simply execute application.processmessages in it
over and over doesn't work either.

How has that messagepump to look like? Any example?

Greetings and thanks so far

Markus


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