Поддержка / Donate
 

WebMoney

Яндекс.Деньги

SMS.Копилка
Деньги@Mail.ru
Rupay
E-gold
PayPal

 

Благодарю за поддержку!

Лента RSS - Новости сайта Новости сайта
Лента RSS - Новости форума Новости форума
Добавить в закладки и поделиться Bookmark and Share

 

Архив исходников

 


Automatic translation

 
English German French
Italian Spanish Portuguese
Greece Japan Chinese
  Korean  

  

 

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Google  
 

Создать мультимедийный таймер

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{ 
  The timeSetEvent function starts a specified timer event. 
  The multimedia timer runs in its own thread. After the event is activated, 
  it calls the specified callback function or sets or pulses the spe 
  cified event object. 

  MMRESULT timeSetEvent( 
  UINT           uDelay, 
  UINT           uResolution, 
  LPTIMECALLBACK lpTimeProc, 
  DWORD_PTR      dwUser, 
  UINT           fuEvent 
  ); 

  uDelay: 
   Event delay, in milliseconds 

  uResolution: 
   Resolution of the timer event, in milliseconds. 
   A resolution of 0 indicates periodic events should occur with the 
   greatest possible accuracy. 
   You should use the use the maximum value appropriate to reduce system overhead. 

  fuEvent: 
   TIME_ONESHOT Event occurs once, after uDelay milliseconds. 
   TIME_PERIODIC Event occurs every uDelay milliseconds. 
}


 uses
   MMSystem;

 var
   mmResult: Integer;


 // callback function 
procedure TimeCallBack(TimerID, Msg: Uint; dwUser, dw1, dw2: DWORD); pascal;
 begin
   // Do something here. This procedure will be executed each 10 ms 
  Form1.Label1.Caption := Form1.Label1.Caption + '%';
 end;

 // Set a new timer with a delay of 10 ms 
procedure TForm1.Button1Click(Sender: TObject);
 begin
   mmResult := TimeSetEvent(10, 0, @TimeCallBack, 0, TIME_PERIODIC);
 end;


 // Cancel the timer event. 
procedure TForm1.FormDestroy(Sender: TObject);
 begin
   TimeKillEvent(mmResult);
 end;



Источник - Проект "Delphi World" © Выпуск 2002 - 2004
Автор проекта: Акулов Николай



   Rambler's Top100             Яндекс цитирования