Ja, du skal selv tilføye DateUtils under
uses.
Dette virker fint hos meg. Her er hele uniten:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DateUtils, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
iTimeStarted,
iUptime: Int64;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
iUptime := 0;
iTimeStarted := GetTickCount;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
iUptime := (GetTickCount - iTimeStarted) div 1000;
Label1.Caption := Format('Tiden programmet har vært åpent: %s', [TimeToStr(UnixToDateTime(iUptime))]);
end;
end.
-------------------------------------
I am AGAINST TCPA!!
[
http://www.againsttcpa.com/ ]
-------------------------------------
Mvh
DiZpel