Thema: Delphi Realtime Input? Thread?

Einzelnen Beitrag anzeigen

Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#14

Re: Realtime Input? Thread?

  Alt 14. Mai 2006, 13:32
I still don't know why you want to do this with a thread, if you mind looking at my post above.

But if, this is how to do it:

- place the query (or whatever fetches the input form the user) in a thread
- after the query was answered and confirmed by the user, the thread sets a variable "I'm done", places the user input somewhere the main thread has access to and goes asleep/terminates

- in your main thread, you use MSDN-Library durchsuchenwaitforsingleobject to wait until the thread does set this variable, fetch the input and continue your loop.

But unless you have to keep your app doing something else while waiting for the input (which wouldn't work the way I just described it), i don't know why you would want to use a thread here...

EDIT: you don't initialize your "i" in the thread, so it'll probably take a long time until it gets to "3". but I can't see any othermistakes in it.
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
  Mit Zitat antworten Zitat