Autor Beitrag
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Mi 01.07.09 18:08 
Hat alles super keklappt bis auf eins:
wenn das Programm im Infobereich ist und eine Stunde rum ist passiert nichts wieso?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 01.07.09 18:10 
Welchen Code hast du denn jetzt in deinem Programm drin?
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Mi 01.07.09 18:23 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, CoolTrayIcon, StdCtrls, Menus, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    CoolTrayIcon1: TCoolTrayIcon;
    PopupMenu1: TPopupMenu;
    Anzeigen1: TMenuItem;
    Timer1: TTimer;
    Timer2: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Anzeigen1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 coolTrayIcon1.iconvisible := true;
 form1.hide;
 timer1.enabled := true;
end;

procedure TForm1.Anzeigen1Click(Sender: TObject);
begin
form1.show;
timer1.Enabled := false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if FormatDateTime('mm:ss', Now)='18:12' then
              ShowMessage('Es ist mal wieder eine volle Stunde rum!');
              timer2.enabled := true;
              timer1.Enabled := false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
timer2.Enabled := false;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
if FormatDateTime('mm:ss', Now)='18:12' then
              ShowMessage('Es ist mal wieder eine volle Stunde rum!');
              timer2.Enabled := false;
              timer1.Enabled := true;
end;

end.

Sorry ich weiß nicht wie das geht das der Code in so nem ding zum scrollen drin ist

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 01.07.09 18:31 
user profile iconhenny hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
if FormatDateTime('mm:ss', Now)='18:12' then					
Ist dir denn klar was der Code macht?

user profile iconhenny hat folgendes geschrieben Zum zitierten Posting springen:
Sorry ich weiß nicht wie das geht das der Code in so nem ding zum scrollen drin ist
Ich muss zugeben, dass in der Hilfe im Forum die Kategorie etwas unglücklich bezeichnet ist. Wenn du einen so formatierten Beitrag zitierst, siehst du es z.B. auch. Nämlich:
ausblenden Quelltext
1:
<span class="inlineSyntax"><span class="codecomment">{PROTECTTAG49681fa489931e7169f80538c37d4af3}</span></span>					
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Mi 01.07.09 18:38 
Nicht ganz was macht der Code?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 01.07.09 18:43 
Siehe Hilfe:
docs.codegear.com/pr...tring@TDateTime.html
Die Minuten und Sekunden der aktuellen Uhrzeit werden mit '18:12' verglichen. Ausgelöst würde das also genau z.B. um 18:18:12 Uhr, also bei 12 Sekunden nach 18:18 Uhr.
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Mi 01.07.09 18:55 
Und wie mache ich das er die Zeit 18:59 Uhr oder so abfrägt?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 01.07.09 18:57 
Dafür musst du wohl auf Stunde und Minute testen. Und wie du FormatDateTime dazu bringst, sagt dir die verlinkte Hilfe.
Und zudem darfst du die Anzeige nicht mehrfach auslösen, wenn der Timer auf unter einer Minute gesetzt ist.

Und wie das am besten geht habe ich ganz am Anfang schon geschrieben... :roll:
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
So oft muss der Timer ja vielleicht gar nicht laufen. Ich würde mir eher die vorherige Stunde merken und schauen wann die nächste begonnen hat. Die Stringumwandlung ist doch überflüssig.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
CurrentHour: Integer;

...

CurrentHour := Floor(Time * 24);

...

// Timer:
if Floor(Time * 24) > CurrentHour then
begin
  ...
Floor ist aus der Unit Math.
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Mi 01.07.09 19:22 
Vielen Vielen dank an alle die mir geantwortet haben es hat alles bestens geklappt!