Réponse acceptée !
Bonjour lofti213_b19
voici une technique qui te permettra d'avoir qu'une seule fois l'heure d'affiché.
Il faut que tu déclares une function qui va te reformater la titre de ta fenetre sans l'heure...
function GetCaptionWithoutTime(const sCaption : string): PChar;
var
sTime : string;
dtTime : TDateTime;
begin
sTime := Copy(sCaption, Length(sCaption) - 7, 8);
ifnot TryStrToTime(sTime, dtTime) then
Result := PChar(sCaption)
else
Result := PChar(Copy(sCaption, 1, Length(sCaption) - 8));
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
TheForeGround:THandle;
CaptionFocused:Array [0..255]of char;
text:string;
begin
TheForeGround:=GetForegroundWindow;
GetWindowText(TheForeGround,CaptionFocused,256);
form1.Caption:=CaptionFocused;
text:=timetostr(time);
SetWindowText(TheForeground,Strcat(GetCaptionWithoutTime(CaptionFocused),PChar(text)));
end;
Bonne Prog,
Olivier
PS : Lorsqu'une réponse vous convient, n'oubliez pas de la valider.