unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MMSystem;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
FID : integer; // ID des MMTimers--
procedure TimerCallback( TimerID, Msg : UINT; dwUser, dw1, dw2 : DWord); pascal;
implementation
{$R *.dfm}
//////////////////////////////////////////////////////////////////////////////////
procedure TimerCallback( TimerID, Msg : UINT; dwUser, dw1, dw2 : DWord); pascal;
begin
showmessage('Timer');
end; // von timercallback
/////////////////////////////////////////////////////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
begin
// Aufruf
FID := TimeSetEvent ( 1000,0, @TimerCallback, 0, TIME_PERIODIC);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if FID <> 0 then timeKillEvent(FID);
end;
end.