was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

44 Visitors Online


 
...einen Multimedia Timer programmieren?
Autor: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch
[ Tip ausdrucken ]  

Tip Bewertung (31):  
     


{
  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;



 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners