Using VCL TTimer in Delphi console application

后端 未结 3 1993
走了就别回头了
走了就别回头了 2021-02-04 09:14

As the question subject says. I have a console application in Delphi, which contains a TTimer variable. The thing I want to do is assign an event handler to T

3条回答
  •  醉梦人生
    2021-02-04 09:57

    Console applications don't have a message pump, but do have threads. If you create a thread that does the work and waits for the next second when the work is done, you should get the result you want. Read the documentation about TThread how to create a dedicated thread. Getting data to and from a thread is less straightforward though. That's why there are a number of alternatives to the 'raw' TThread that help with this, like OmniThreadLibrary.

提交回复
热议问题