Autor Beitrag
The...
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: So 06.02.05 05:23 
:arrow: Hi,
also ich lasse mir in Label33 die system zeit anzeigen

ausblenden Delphi-Quelltext
1:
label33.Caption:=TimeToStr(Now);					



und dann habe ich da edit1 , nun sollte der rechner runterfahren wenn label33 mit edit1 überein stimmt und checkbox1 'an' ist, dazu nehme ich diesen code!


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin


if label33.caption = edit1.text then
winexec('shutdown.exe -s', 1);


end;




Das problem ist.... er macht es nicht, also irgendwie denkt er das edit1 nicht mit label33 übereinstimt :?: :!: :?: :!: :?: :!:


WARUM :?:

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconChristian S.: Topic aus Windows API verschoben (scheint eher ein Problem in der Komponenten-Nutzung zu sein)
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: So 06.02.05 07:41 
Titel: Re: shutdown code geht nicht!
The... hat folgendes geschrieben:
[...]
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  if label33.caption = edit1.text then
    winexec('shutdown.exe -s', 1);
end;
Dein Code wird nur ausgeführt, wenn Du checkbox1 anklickst - und zwar genau dann und nur einmal! In diesem Moment muss der Inhalt von label3.caption exakt dem Inhalt von edit1.text entsprechen, damit Dein winexec ausgeführt wird.

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: So 06.02.05 16:44 
jop das habe ich germerkt... aber wie geht das denn?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 06.02.05 17:07 
In dem du in einem Timer-Ergeignis die Uhrzeit vergleichst und prüfst, ob die Checkbox markiert ist.
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 07.02.05 02:19 
gut, aber wie kann ich denn das prog. denn testen lass ob die box akltivirt ist? und warum muss ich die zeiten in ein timer überprüfen lassen?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 07.02.05 02:24 
du könntest die prüfung auch bei edit1.onchange oder label33.onchange vornehmen, dann brauchst du keinen timer.
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 07.02.05 02:51 
wi kann ich das prüfen?

also im moment ist das so

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Edit1Change(Sender: TObject);

var
Change: TNotifyEvent;
begin
Edit1.OnChange
end;



procedure TForm1.CheckBox1Click(Sender: TObject);

begin
if label33.caption = edit1.text then
winexec('shutdown.exe -s', 1);
end;

end.

natürlcih geht das nicht!!!!

Aber warum, was ist nicht richtig? :?:
matze.de
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 576

Win95, Win98 SE, WinXp Prof SP2
D7P, D8P, FPC2.0
BeitragVerfasst: Mo 07.02.05 09:01 
probier mal das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Label33Change(Sender: TObject);
begin
if (Checkbox1.Checked) AND (Label33.Caption = Edit1.Text) then
  winexec('shutdown.exe -s', 1);
end;

Jedesmal wenn die ystemzeit im label aktualisiert wird, prüft er ob die checkbox gedrückt ist und ob die zeit mit der im Edit übereinstimmt.

mfg matze

_________________
si tacuisses, philosophus mansisses.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 07.02.05 09:49 
Hallo!

WinExec sollte man aus Gründen der Kompatibilität nicht mehr benutzen. Benutze deshalb besser Suche in: Delphi-Library SHELLEXECUTE.

Gruß
Tino
IngoD7
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 629


D7
BeitragVerfasst: Mo 07.02.05 13:49 
So, so, ein OnChange bei einem Label ... :shock:
matze.de
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 576

Win95, Win98 SE, WinXp Prof SP2
D7P, D8P, FPC2.0
BeitragVerfasst: Mo 07.02.05 13:52 
IngoD7 hat folgendes geschrieben:
So, so, ein OnChange bei einem Label ... :shock:


Ups sowas hat das Standard label ja gar nicht ;D *lol*

mfg matze

_________________
si tacuisses, philosophus mansisses.
The... Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122



BeitragVerfasst: Mo 07.02.05 16:01 
also so haeb ich das nun gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if (Checkbox1.Checked) AND (Label33.Caption = Edit1.Text) then
  winexec('shutdown.exe -s', 1);
label33.Caption:=TimeToStr(Now);
end;


UND ES GEHT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

also diese timer sind echt schon ne schöne sache :D :wink: :!:

Aber was soll das mit der Kompatibilität heißen??? geht das denn nich auf allen rechner oder macht das prog. was kaputt?

:arrow: okey erstmall vielen dank für die hilfe und lösung meines problems :!:
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 07.02.05 16:15 
The... hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if (Checkbox1.Checked) AND (Label33.Caption = Edit1.Text) then
  winexec('shutdown.exe -s', 1);
label33.Caption:=TimeToStr(Now);
end;


besser wäre:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
label33.Caption:=TimeToStr(Now);
if (Checkbox1.Checked) AND (Label33.Caption = Edit1.Text) then
  winexec('shutdown.exe -s', 1);
end;

sonst wird das event nämlich einen timerinterval zu spät gestartet.