Delphi
--
Questions
--
Followers
Top Experts
TReadRespThread = class(TThread)
private
{ Private declarations }
Timer : TTimer;
procedure NewTimer1Timer(Sender: TObject);
protected
procedure Execute; override;
public
end;
procedure TReadRespThread.Execute;
begin
inherited;
Timer := TTimer.Create(Application)
Timer.Interval := 100;
Timer.OnTimer := NewTimer1Timer;
Timer.Enabled := True;
end;
procedure TReadRespThread.NewTimer1T
begin
//for some reason the program flow never comes here
end;
1. Why doesn't it work?
2. Is such a Timer running in a separate thread (not in the main thread)?
Jackie boy :-)
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
*** The reason is:
I have a dll with some functions inside. I have also the demo application showing how to use them. In this demo application there is a TTimer with Interval := 100, OnTimer it triggers function to check the values of a variable populated by the functions from the dll.
Unfortunatelly there is no way to catch the moment where this variable is populated, that is why the TTimer checks it.
I have the old application which works fine with the old hardware. My task is to make it work with the new hadware (using the dll). The way it works now is:
it sends command to the hardware using WriteFile function
it receives the response using ReadFile
It would be great to replace these Windows commands with functions from DLL,
it would save a huge amount of work.
So my plan was to:
1. Send a command using dll function (it works fine)
2. Run TTimer in working thread to check if we have a response with 100 ms intervals
3. When we got then CreateEvent(MyEvent);
4. In main thread: WaitForSingleObject(MyEven
(WaitForSingleObject blocks the main thread and this is why I can't use TTimer put on the Form).
Provide the old application with the response adjusted to the variable it works with now.
hope I explained it properly
Jackie boy
And this is USB device :-)
Jackie boy






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
you can use the JCL TThreadTimer Component from the the JCL Threading.
you may download it from here
http://sourceforge.net/project/showfiles.php?group_id=45786

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Delphi
--
Questions
--
Followers
Top Experts
Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.