Вниз
Скачать: CL | DM;

TTimer в API приложении.   Найти похожие ветки 

← →
Mazenrat   (2002-09-16 15:36) [0]

Привет.

Как в приложении на чистом API использовать TTimer, организовать событие OnTimer? Если у кого-то есть пример, пожалуйста, представьте.


← →
Xemax   (2002-09-16 15:49) [1]

пусть твой обработчик сообщений обрабатывает WM_TIMER.


← →
Kaban ©   (2002-09-16 16:00) [2]

unit WinTimer;
interface
uses Windows, Classes;

type
TWinTimer=class
Parent:integer;
constructor Create(hParent:integer);
destructor Destroy; override;
private
TimerID:integer;
FInterval:integer;
FEnabled:boolean;
procedure SetEnabled(b:boolean);
procedure SetInterval(i:integer);
published
property Enabled:boolean read FEnabled write SetEnabled;
property Interval:integer read FInterval write SetInterval;
End;

var
iTimers : Integer;

implementation

constructor TWinTimer.Create(hParent:integer);
begin
FInterval:=1000;
Parent:=hParent;
FEnabled:=false;
Inc(iTimers);
TimerID:=iTimers
end;

procedure TWinTimer.SetEnabled(b:boolean);
begin
If FEnabled=b Then Exit;
FEnabled:=b;
If b Then
SetTimer(Parent,TimerID,FInterval,nil)
Else
KillTimer(Parent,TimerID)
end;

procedure TWinTimer.SetInterval(i:integer);
begin
If FInterval=i Then Exit;
FInterval:=i;
If NOT FEnabled Then Exit;
KillTimer(Parent,TimerID);
SetTimer(Parent,TimerID,i,nil)
end;

destructor TWinTimer.Destroy;
begin
KillTimer(Parent,TimerID)
end;


end.


← →
Kaban ©   (2002-09-16 16:09) [3]

var
iTimers : Integer = 0;



← →
REA   (2002-09-16 16:51) [4]

Исходник в Delphi как раз и есть. Они не сильно будут отличаться.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.013 c
3-92344
Alexsys
2002-10-03 18:34
2002.10.28
SQL запрос с несколькими таблицами с несоответствием...


14-92667
Jumbot
2002-10-05 20:08
2002.10.28
СРОЧНО!!! HELP ME!!! SOS!!!


3-92364
Kolya
2002-10-06 08:58
2002.10.28
База данных БЕЗ dll


8-92614
Yuri Btr
2002-06-27 13:59
2002.10.28
Битрэйт звуковых файлов ?


1-92539
Batiskaf
2002-10-14 17:19
2002.10.28
TControl.SetFont




   Наверх