Can't you simply add to the procedure Timer as local variable, enable it in first line, and disable and get what you need then?
I think code would look like this:
- Code: Select all
procedure xxx;
begin
var Timer1: TTimer;
begin
Timer1:=TTimer.create(?);
Timer1.Interval:=1;
Timer1.Tag:=0;
Timer1.Enabled:=true;
...
Timer1.enabled:=false;
end;
procedure Timer1.OnTimer(?);
begin
inc(tag);
end;
Question mark means I don't remember what is there (if anything).
I think tag variable isn't used by component itself and you can put there whatever you want.
Simple ideas are the best, but I don't know whether it works or not. Did you try something like that? Or could you just put here your source code?
PS. I'm not responsible for any effect this code will have on your computer (including blowing up).