?
Solved

input capture

Posted on 1999-11-23
6
Medium Priority
?
160 Views
Last Modified: 2010-04-04
i want to find a way to know where is the mouse on the screen, even if the mouse is out of the active form, and how to do a screenshoot.
the third part is the keyboard:i would know how to read directly from the keyboard, even is the program is not active.
0
Comment
Question by:ralph78
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 800 total points
ID: 2228516
hi ralph..

a) var
   P: TPoint;
   begin
   GetCursorPos(P);
   end;

b)
Handle:=GetDesktopWindow;
Handle:=GetWindowDC(Handle);
BitBlt(image1.canvas.handle,0,0,form2.width,form2.height,Handle,0,0,SRCCOPY);

that copies the screen to a canvas (here image1.canvas).


c) you have to install a hook:

to install the hook for the keyboard :
myhook:=setwindowshookex(wh_keyboard, @clavier_hook_msg, system.hInstance, 0);

where clavier_hook_msg is a callback procedure defined as follow :
function clavier_hook_msg(code: Integer; wparam: Word; lparam: Longint): longint; stdcall;
begin
  if (code<0) then
    result:=callnexthookex(clavier_crochet, Code, wparam, lparam)
  else
  begin
    your_job;
    result:=0; {continue the message to other hook/windows <>0 stop the message}
  end;
end;

wparam will containt the virtual key code of the pressed key and iparam some information about keyboard status

and finally to iuninstall the hook :
unhookwindowshookex(myhook);


regards
rene
0
 
LVL 1

Expert Comment

by:men xin
ID: 2230200
@_@
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2230513
The hook function must be in a dll. Otherwise it won't work system wide...

Regards, Madshi.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
LVL 2

Expert Comment

by:rene100
ID: 2237657
ralph?
0
 
LVL 1

Expert Comment

by:men xin
ID: 2275088
another way,you may use setcapture.

menxin
0
 
LVL 1

Expert Comment

by:men xin
ID: 2275093
if you only want to know mouse's pos,you can use mouse.cursorpos.

menxin
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question