Autor Beitrag
volvox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Do 03.04.08 11:14 
Hi, ich brauche ein Programm, dass den Mauszeiger nach einer vorher eingestellten Zeit kurz bewegt, um z.B. den Bildschirmschoner zu unterdrücken (Ja, ich weiß wie man den ausschaltet *gg*, ist nur ein Beispiel). Ich habe allerdings bisher immer nur auf ganz normale Anwendungen mit ner form programmier und will nun, dass der Mauszeiger bewegt werden kann, egal wo er gerade ist.

Ich würd halt einfach die Position des Zeiges um ein paar pixel verschieben und dass immer OnTimer auslösen, aber wie bekomme ich den Zeiger z.B. auch außerhalb meines Anwengungsfensters?

Hat jemand ne Idee oder ein (halb-?)fertiges Programm für mich?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 03.04.08 11:18 
ausblenden Delphi-Quelltext
1:
SetCursorPos(X, Y);					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
volvox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Do 03.04.08 11:36 
Jo, ist klar. Aber ich denke, dass dieser Befehl nur so lange funktioniert, wie das Programm/Die Form aktiv ist
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 03.04.08 11:43 
Aus dieser Antwort schließe ich, dass du es noch nicht einmal ausprobiert hast.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Do 03.04.08 11:57 
Hallo. SetCursorPos ist eine Funktion aus der Windows-API, also sozusagen ein Windows-Befehl. Der funzt immer. Aber ich muss GTA rechtegeben, in der Zeit die du für dein Reply benötigt hast hättest du es zweimal ausprobieren können.

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
volvox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Do 03.04.08 12:04 
Tatsächlich! Es klappt^^. Danke, aber ich hätte nicht gedacht, dass es so simpel ist. Nur mit dem ermitteln der aktuellen Zeigerposition hab ich noch ein problem. Wie ist der Befehl? Komm ich um ein array nicht drumherum oder kann ich zwei integers für x und y nehmen?
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Do 03.04.08 12:15 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
  var
    punkt: TPoint;
begin
  getCursorPos(punkt);
  setCursorPos(punkt.X+10,punkt.Y-5);
end;


Alternativ kannst du auch mouse_event() zur maussteuerung verwenden (damit kann man dann sogar klicks etc. pp. emulieren)

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
volvox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Do 03.04.08 12:21 
Danke