Autor Beitrag
Radioactive
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Do 06.01.05 15:38 
Hi,

wenn ich unter Windows etwas länger warte, wird (bei entsprechender Einstellung) der Bildschirm zum Stromsparen oder gegen neugierige Blicke :wink: abgeschalten. Wie kann ich das aus einem Delphi-Programm heraus machen (Also ich klicke z.b. auf Button1 und der Bildschirm geht aus) ?

Und da fällt mir gleich eine dazu passende Frage ein: Wie schalte ich den Bildschirmschoner ein (z.B. gab es unter Office97 eine "Short-Cut"-Leiste, die einen Bildschirmschonerbutton hatte) ?

Radioactive
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 06.01.05 15:51 
Hiermit aus:
ausblenden Delphi-Quelltext
1:
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);					


Und damit wieder an:
ausblenden Delphi-Quelltext
1:
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);					
mikeyboy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Do 06.01.05 15:57 
da ich selbst an dem Thema interessiert bin hätte ich noch eine kurze frage?

wenn ich auf den Button klicke ist der Bildschirm aus okay! Aber wie soll i den Bildschirm einschalten wenn i nix seh??
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 06.01.05 15:58 
mach n timer den du dann aktivierst und der nach dem timerintervall den monitor wieder anschaltet
mikeyboy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Do 06.01.05 16:00 
OK thx
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 06.01.05 16:02 
also so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
timer1.enabled:= true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
timer1.enabled:= false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.enabled:= false;
timer1.interval:= 5000;
end;

Dann schalltet er nach 5 sek wieder ab
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Do 06.01.05 16:02 
War schonmal gut, geht aber nur unter Win95. Da das aktuelle Betriebssystem WinXP ist, das ich auch habe, zeigt der Befehl keine Wirkung. :(
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 06.01.05 16:05 
so gehts auch bei winXP
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 1);
timer1.enabled:= true;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
timer1.enabled:= false;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.enabled:= false;
timer1.interval:= 5000;
end;
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Do 06.01.05 17:03 
OK, jetzt geht er schon mal aus. Aber er bleibt bei mir nur 2-3 sec aus, dann geht er wieder an. Vielleicht liegt das aber auch daran, dass ich gerade im Internet bin (modem). Ich werde es nochmal offline versuchen.
Wie bekommt man jetzt den Bildschirmschoner an?
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 06.01.05 17:20 
ausblenden Delphi-Quelltext
1:
timer1.interval:= 5000;					

Stell mal das intervall höher, dann dauerts auch länger ...
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Do 06.01.05 17:31 
Ganz toller Tip. So blöd bin ich nun auch wieder nicht. Ich habe das Intervall auf 10s gestellt, und es bleibt bei den 2-3s. Aber wie gesagt, es liegt warscheinlich nicht am Code, sondern an meinem Computer.
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 06.01.05 19:12 
entweder daran oder am monitor, ich glaube das ist eine schutzfunktion, weil wenn man sowas komplett in nen timer packt und dann interval auf 1 ms stellt geht der monitor kaputt :?
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 08.01.05 14:05 
so etwas ähnliches Denke ich auch. Es klappt auch prima, wenn ich es nur einmal mache. Wenn ich es aber öfters hintereinander versuche, bleibt es bei 2-3 sec.
Lassen wir das, der Teil des Threads ist, denke ich, jetzt erledigt. Wenden wir uns dem Biildschirmschoner zu. (Ich werde dafür einen eigenen Thread aufmachen)
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 27.01.05 15:58 
hab den thread net gefunden, weiß net ob dus schon hast auf jedenfall:

ausblenden Delphi-Quelltext
1:
2:
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, 1Nil0); //An
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0Nil0); //Aus


müsste gehen
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Fr 28.01.05 18:51 
Danke. Werde es in den anderen Thread reinschreiben.

_________________
Radioactive
"Wer scrollt, verliert!" Matthias Stein, Informatiklehrer am GG
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 30.01.05 12:29 
wo ist denn der andere thread ?
Radioactive Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: So 30.01.05 12:51 
Der andere Thread ist hier:
:arrow: www.delphi-forum.de/viewtopic.php?p=212122

_________________
Radioactive
"Wer scrollt, verliert!" Matthias Stein, Informatiklehrer am GG