hm... vet du hvordan man gør d når man bruker TMMAudioPlayer? er ikke akkuratt mester i programmering, og har nettop begynt å lære meg om multimedia... (er selvlært, går ikke på høyskole ellr no...)
// TThreadTimer -> TComponent // A timer replacement that uses a thread to manage the timer events.
// Feel free to modify and use this code. // The only thing I ask, is that you leave my name in the source file.
// Please note that I provide this code as an example, and I // make no warranties whatsoever on the results of using this code. // Meaning: Whatever happens because you've used this code, is your own // responsibility.
// Also note that I have NOT tested this code very thoroughly, I just // wrote it in response to several newsgroup messages requesting information // on how to implement SysTray icons.
// Thule Air Base, Greenland, May 30. 2000 // Jens Borrisholt
constructor TThreadTimer.Create; begin inherited; FPriority := tpNormal; end;
//Changing the Enabled property calls either Start or Stop protected methods.
procedure TThreadTimer.setEnabled(b: boolean); begin if b then Start else Stop; FEnabled := bRunning; end;
// Starting the timer creates an instance of TTimerThread and launches the thread.
procedure TThreadTimer.Start; begin if bRunning then Exit; bStop := false; with TTimerThread.CreateTimerThread(self) do begin Priority := FPriority; Resume; end; bRunning := true; end;
//Stopping the timer just sets the stop flag to //true, the TTimerThread's Execute method will //then end and the thread will be destroyed.
procedure TThreadTimer.Stop; begin bStop := true; bRunning := false; end;
//Execute method for the spawned thread. Just //repeats while the timer is enabled, and calls the //timer object's OnTimer event.
procedure TTimerThread.Execute; var SleepTime, Last: integer; begin while not tt.bStop do begin Last := timeGetTime; Synchronize(DoExecute); SleepTime := tt.FInterval - (Integer(timeGetTime) - Last); if SleepTime < 10 then SleepTime := 10; sleep(SleepTime); end; end;
//This method is called within the TTimerThread's //Execute, using the Synchronize method. This is //because we need to call the event handler from //the main VCL thread.
procedure TTimerThread.DoExecute; begin with tt do begin if Assigned(FOnTimer) then FOnTimer(tt); end; end;
lol.. nå fikke jeg ikke kompilert pga at jeg ikke hadde masks.dcu (jeg spør IKKE om å få den filen, siden jeg har fått vite at det ike er lov)...
anntar jeg må skrinlegge prosjektet til jeg har råd til en bedre delphi versjon...
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.