Thanks Myles. In the end I decided to split out the Telnet functionality to a small system tray app that feeds up the data via an Automation server. Quite flexible now.
Cheers, Phil. ----- Original Message ----- From: "Myles Penlington" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Thursday, September 04, 2003 9:27 AM Subject: RE: [DUG]: INDY Telnet > WaitHandle, Is the Threadhandle. Be careful with thread.execute - you have > to start it suspended, else by the time the loop starts it could not have a > valid handle. WM_CLOSE - is one of my own - Windows will in somecases send a > WM_QUIT to every thread in an application that has a message loop. i.e good > programming practice - I read about it somewhere, but can no longer remember > the exact source - was in MS docs somewhere. > > Basically you can stop it by setting Terminate on the thread, but then you > have to send a message to wake it up from the wait condition. > > Myles. > > -----Original Message----- > From: Phil Middlemiss [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 3 September 2003 14:22 > To: Multiple recipients of list delphi > Subject: Re: [DUG]: INDY Telnet > > > Does that mean I have to explicitly send either WM_CLOSE_SESSION or WM_QUIT > to the thread or does that happen automatically? > > Phil. > ----- Original Message ----- > From: "Myles Penlington" <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Tuesday, September 02, 2003 5:21 PM > Subject: RE: [DUG]: INDY Telnet > > > > In this case it may be easiest to run the indy components in their own > > thread. Otherwise you would somehow have to hook the parent applications > > message loop. > > > > Look at TApplication.ProcessMessage etc for a message loop, however for > your > > own thread, you don't need all the extra baggage that is present in the > > TApplication message loop. > > > > e.g. An example of a simple message loop I use in TThread.Execute > > > > while not Terminated do begin //This is > > just to wait around and process the messages when they are required. > > try //Sleep > all > > day and then do something occassionally. > > if (MsgWaitForMultipleObjects( 1, WaitHandle, False, DeadTime, > > QS_ALLINPUT) = WAIT_TIMEOUT) then Terminate > > else begin > > while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin > > if (Msg.Message = WM_CLOSE_SESSION) > > or (Msg.Message = WM_QUIT) then Terminate > > else begin > > TranslateMessage(Msg); > > DispatchMessage(Msg); > > end; > > end; > > end; > > except > > //Report issue? > > end; > > end; > > > > Myles. > > > > -----Original Message----- > > From: Phil Middlemiss [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, 2 September 2003 16:49 > > To: Multiple recipients of list delphi > > Subject: Re: [DUG]: INDY Telnet > > > > > > I'm not explicitly using threads, but the Indy components are generally > > threaded. How do I go about using a message loop/pump? > > ----- Original Message ----- > > From: "Myles Penlington" <[EMAIL PROTECTED]> > > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > > Sent: Tuesday, September 02, 2003 4:35 PM > > Subject: RE: [DUG]: INDY Telnet > > > > > > > You may need a message loop/message pump on the thread being used. > > > Myles. > > > > > > -----Original Message----- > > > From: Phil Middlemiss [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, 2 September 2003 16:16 > > > To: Multiple recipients of list delphi > > > Subject: [DUG]: INDY Telnet > > > > > > > > > I'm trying to use the Indy Telnet component from inside a DLL without > > > success. I get the status messages alright, but the OnDataAvailable > event > > > never fires (fires correctly when the component is in the main exe). > > > > > > Does anyone know a way around this? > > > > > > Phil. > > > > > > > > > > -------------------------------------------------------------------------- > > - > > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > > Website: http://www.delphi.org.nz > > > To UnSub, send email to: [EMAIL PROTECTED] > > > with body of "unsubscribe delphi" > > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > -------------------------------------------------------------------------- > > - > > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > > Website: http://www.delphi.org.nz > > > To UnSub, send email to: [EMAIL PROTECTED] > > > with body of "unsubscribe delphi" > > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > > > > > > -------------------------------------------------------------------------- > - > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > Website: http://www.delphi.org.nz > > To UnSub, send email to: [EMAIL PROTECTED] > > with body of "unsubscribe delphi" > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > -------------------------------------------------------------------------- > - > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > Website: http://www.delphi.org.nz > > To UnSub, send email to: [EMAIL PROTECTED] > > with body of "unsubscribe delphi" > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
