TApxComPort.SetTimerTrigger

TApxComPort

procedure SetTimerTrigger(
  const Handle : Word; const mSecs : DWORD;
  const Activate : Boolean);

Activates or deactivates a timer trigger.

Timer triggers are activated in two steps. The trigger is added using AddTimerTrigger, then the trigger is activated using SetTimerTrigger. The duration of the timer is specified when the trigger is activated.

Handle is the handle returned when the trigger was added. mSecs is the duration of the timer in milliseconds.

Activate is True to activate the trigger, False to deactivate it. The mSecs parameter is ignored when Activate is False.

After the specified time elapses the internal dispatcher generates an OnTriggerTimer event. The trigger handle is passed to the event handler so that it can detect which timer expired.

Timer triggers generate a single OnTriggerTimer event. The timer is automatically disabled after it triggers once. Your program must call SetTimerTrigger again to reuse the timer.

The following example adds a timer trigger and activates it with a 2 second timeout:

var
  MyHandle : Word;
...
MyHandle := ApxComPort.AddTimerTrigger;
ApxComPort.SetTimerTrigger(MyHandle, 2000, True);

See also: AddTimerTrigger