Autor Beitrag
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 08.09.03 12:18 
gibt es einen windows-parameter, welcher darstellt ob der PC gerade Inaktiv ist oder nicht?

unter inaktiv verstehe ich:
keine aktiven tasks, keine mausbewegungen, keine tastenklicks?

ich schreibe gerade an einem programm welches nach einer bestimmten zeitraum bei inaktivität starten soll.

_________________
Patrick
im zweifelsfall immer das richtige tun!!!


Zuletzt bearbeitet von patrick am Do 18.09.03 09:18, insgesamt 1-mal bearbeitet
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mo 08.09.03 13:04 
Schreib dein Programmcode in einen Thread mit der Prio tpIdle. Der wird dann nur ausgeführt, wenn das system im Leerlauf ist.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 08.09.03 17:25 
danke,
aber damit wäre nur ein teil des problems gelöst.
wie sieht es mit keine mausbewegungen und keine tastenklicks aus?
das system ist ja auch nicht ausgelasstet wenn der user gerade etwas auf dem pc liest.

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 08.09.03 17:36 
also ob die maus bewegt wird kann man so abfragen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var
  tempX:integer=0;
  tempY:integer=0;
  idletime:integer=0;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
     if (tempX = mouse.CursorPos.x) OR (tempY = mouse.CursorPos.y) then
        inc (idletime)
     else
         idletime := 0;

Caption := FloatToStr ( idletime / 10);

if (idletime / 10) > 40 then caption := caption + '  User ist Idle seit ' + FloatToStr(trunc (idletime/10/60)) + ' Minuten';


tempX := mouse.CursorPos.x;
tempY := mouse.CursorPos.y;
end;

Der Timer ist auf 100ms gestellt !
Das ist nciht die eleganteste Methode aber das geht !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 08.09.03 17:49 
fast 100% die selbe funktion hab ich mir auch schon ausgedacht, allerdings bereiten mir die tasteneingaben sorgen.

hooks möchte ich eigendlich nicht verwenden...

wie machte es den der Windows bildschirmschoner?

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mo 08.09.03 18:40 
Der abgebildetete Code hat ein Nachteil, die Mausbewegungen aus Non-Client-Bereich werden nicht aufgezeichnet, ebenso verhält es sich mit Tastatureingaben. Sowie das Fenster den Focus verliert, erhält es auch KEINE Mouse - und Tastaturevents mehr.
Hier bleibt nur die Möglichkeit, sich in die Nachrichtenschleife (Suche in: Delphi-Forum, Delphi-Library HOOK) einzuhängen, ODER seine Anwendung als Screen-Saver zu programmieren.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 09.09.03 14:57 
also mein code funzt auch, wenn das fenster keinen focus hat !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mi 10.09.03 09:25 
naja, da werden mir wohl nicht so viele andrer möglichkeiten bleiben :eyes:
dann eben mit n paar haken (und ner angel, gummistiefel und nem capingstuhl)

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Fr 12.09.03 07:34 
@MSCH: das mit dem tpIdle-Thread ist Theorie - der läuft bei mir fast immer, auch wenn andere Programme laufen und wenn die Maus bewegt wird. Das ist nur die niedrigste Threadpriorität.

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Fr 12.09.03 09:21 
nicht nur Theorie. Der wird nur ausgeführt, wenn das System im Leerlauf ist. Und Mausgeschubse und Tastenquälerei ist nun nicht gerade Zeitaufwändig. Schau die Im Tastmanager mal die Leerlaufzeiten an. Die meiste Zeit wartet die Kiste auf den, der davor sitzt und sich abrackert.

Probier es es. Schreib ein Thread und lass nebenbei mal ne Stunde die Kiste was extensiv berechnen. Nix da, mit Leerlauf. Also Thread steht.

grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
Tana´Ri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 230



BeitragVerfasst: Fr 12.09.03 09:46 
vielleicht hilft das weiter

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Function LastInput: boolean;
 var LInput : tagLASTINPUTINFO;
 const TIMELIMIT = 10000;
 begin
   result := false;
   LInput.cbSize := SizeOf(tagLASTINPUTINFO);
   GetLastInputInfo(LInput);
   if (GetTickCount - LInput.dwTime) > TIMELIMIT then result := true;
end;

_________________
mfg
Tana´Ri
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Sa 13.09.03 20:59 
vielen dank Tana´Ri ich werde den code schnellstmöglich (morgen oder montag) ausprobieren und euch das ergebnis wissen lassen

CUall

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Di 16.09.03 09:34 
Tana´Ri dein code funktionert leider nicht (win98).
beim kompillieren kommt ne fehlermeldung das die funktion tagLASTINPUTINFO in dll-sowieso nicht gefunden werden kann.

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 16.09.03 18:11 
Logisch:
PSDK hat folgendes geschrieben:

Minimum operating systems: Windows 2000
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Di 16.09.03 21:56 
:oops: :oops: :oops:

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
Tana´Ri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 230



BeitragVerfasst: Do 18.09.03 08:59 
Tut mir leid, da hatte ich keine acht gehabt, das es sich nur um Win98 dreht. Der Gedanke [helfen] zählt :lol:

_________________
mfg
Tana´Ri
patrick Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Do 18.09.03 09:18 
neinnein der code ist in ordung, es wäre zwar besser gewesen wenn es win9x kompatibel gewesen wäre, aber so ist es auch in ordnung
vielen dank für den gedanken :P

_________________
Patrick
im zweifelsfall immer das richtige tun!!!