Delphi The settimer function is used to make timers that can run a program at intervals, requiring two functions, settimer functions, and KillTimer functions.
The following is a simple example:
Var
I:integer = 0;
Procedure Timerproc (Hwnd:hwnd;umsg,idevent:uint;dwtime:dword); stdcall;
Begin
Inc (I);
Form1.caption: = IntToStr (i);
End
Procedure Tform1.formcreate (Sender:tobject);
Begin
SetTimer (handle,10,500, @TimerProc);
End
Procedure Tform1.formdestroy (Sender:tobject);
Begin
KillTimer (handle,10);
End
Sensitive 360 will see this program as a Trojan horse, it may be a lot of Trojans will use a similar timer function bar, SetTimer function almost become a feature of the Trojan Horse
Parameter explanation:
SetTimer altogether four parameters:
1. The handle,windows of the calling function will periodically send WM_TIMER messages to this handle
2.timer identification, can be set to 0
3. The value of the timer, in milliseconds
4. Callback function
1th, 2 parameters can be arbitrarily set, note that the second parameter must be a number, the corresponding killtimer of the first two parameters must be the same as the SetTimer parameter.
The use of SetTimer function in Delphi