Loulibier
Messages postés309Date d'inscriptionjeudi 6 juin 2002StatutMembreDernière intervention24 septembre 20082 28 sept. 2007 à 16:24
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);
if not 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.