Nasao sam na torry.net jedan (komplikovan) tip kako da se detektuje globalni keypress...
http://www.swissdelphicenter.ch/torry/showcode.php?id=1722
A sto se tice pomeranja misa, sto ne bi koristio jedan obican timer?
Code:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Sek:Integer;
MousePosX,MousePosY:Integer;
Temp:TPoint;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
{PRVO BI TREBALO PROVERITI DA LI SCREEN SAVER VEC RADI, POGLEDAJ LINK DOLE}
GetCursorPos(Temp);
if (Temp.X = MousePosX) and (Temp.Y = MousePosY) then
begin
Sek := Sek+1;
if Sek>=10 then
begin
Beep; //samo radi testa
{STARTOVANJE SCREEN SAVERA}
//WinExec ... itd...
end;
end
else
Sek := 0;
MousePosX := Temp.X;
MousePosY := Temp.Y;
end;
end.
Taj link za proveru da li je vec aktivan jedan EXE file (u nasem slucaju screensaver):
http://www.swissdelphicenter.ch/torry/showcode.php?id=616
A man is smart. People are stupid.
My blog