Başka uygulama üzerindeki butonu x,y değerlerini alabilirmi
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
Başka uygulama üzerindeki butonu x,y değerlerini alabilirmi
Delphi ile baska bir uygulamanın içindeki buttonun ekran çözünürlüğüne göre x,y koordinatlarını yani mouse ile üzerine geldiğimde x,y değerlerini nasıl öğreniriz? tabi bu button değilde baska bir nesnede olabilir
Kod: Tümünü seç
implementation
{$R *.dfm}
var
JHook: THandle;
function JournalProc(Code, wParam: Integer; var EventStrut: TEventMsg): Integer; stdcall;
var
Char1: PChar;
s: string;
begin
if Code < 0 then Exit;
if Code = HC_SYSMODALON then Exit;
if Code = HC_ACTION then
begin
s := '';
if EventStrut.message = WM_LBUTTONUP then
s := 'Left Mouse UP at X pos ' +
IntToStr(EventStrut.paramL) + ' and Y pos ' + IntToStr(EventStrut.paramH);
if EventStrut.message = WM_LBUTTONDOWN then
s := 'Left Mouse Down at X pos ' +
IntToStr(EventStrut.paramL) + ' and Y pos ' + IntToStr(EventStrut.paramH);
if EventStrut.message = WM_RBUTTONDOWN then
s := 'Right Mouse Down at X pos ' +
IntToStr(EventStrut.paramL) + ' and Y pos ' + IntToStr(EventStrut.paramH);
if (EventStrut.message = WM_RBUTTONUP) then
s := 'Right Mouse Up at X pos ' +
IntToStr(EventStrut.paramL) + ' and Y pos ' + IntToStr(EventStrut.paramH);
if (EventStrut.message = WM_MOUSEWHEEL) then
s := 'Mouse Wheel at X pos ' +
IntToStr(EventStrut.paramL) + ' and Y pos ' + IntToStr(EventStrut.paramH);
if (EventStrut.message = WM_MOUSEMOVE) then
s := 'Mouse Position at X:' +
IntToStr(EventStrut.paramL) + ' and Y: ' + IntToStr(EventStrut.paramH);
if s <> '' then
Form1.ListBox1.ItemIndex := Form1.ListBox1.Items.Add(s);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if FHookStarted then
begin
ShowMessage('Mouse is already being Journaled, can not restart');
Exit;
end;
JHook := SetWindowsHookEx(WH_JOURNALRECORD, @JournalProc, hInstance, 0);
if JHook > 0 then
begin
FHookStarted := True;
end
else
ShowMessage('No Journal Hook availible');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FHookStarted then
UnhookWindowsHookEx(JHook);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
FHookStarted := False;
UnhookWindowsHookEx(JHook);
JHook := 0;
end;
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
Handled := False;
if (Msg.message = WM_CANCELJOURNAL) and FHookStarted then
JHook := SetWindowsHookEx(WH_JOURNALRECORD, @JournalProc, 0, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
showmessage('Dehanın %1 i ilham %99u terdir.');
end;
end.
begin
showmessage('Dehanın %1 i ilham %99u terdir.');
end;
end.