Процедура для Delphi
Код:
var
timestart,timestop: TTimeStamp;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
timestart := DateTimeToTimeStamp(Now);
Application.Run;
timestop := DateTimeToTimeStamp(Now);
MessageBox(0,PChar(Format('Программа работала %d миллисекунд',
[Trunc(TimeStampToMSecs(timestop) - TimeStampToMSecs(timestart))])),
PChar(Application.Title), MB_OK + MB_ICONINFORMATION + MB_TOPMOST);
end.