Solved

mouse control(verry easy)

Posted on 2001-08-11
24
152 Views
Last Modified: 2012-05-04
hey guy's,
 does enny one have a documetation about mouse control. so i can move doubel click click on the screen?

already thanx
krydea
0
Comment
Question by:krydea
  • 13
  • 8
  • 3
24 Comments
 

Expert Comment

by:kyr
ID: 6376408
You will need to insert the mouse related messages in the system message queue. the only way to do it is by using Hooks.

Specifically search for the WH_JOURNALPLAYBACK Hook
in the Win32 Help Files.
0
 

Author Comment

by:krydea
ID: 6376415
is are the point's to low to give me some exampels?
0
 

Expert Comment

by:kyr
ID: 6376432
to simply position the mouse cursot use
 SetCursorPos(x,y);

for windows hooks related to mouse have a look here
http://www.prestwood.com/forums/delphi/sdug/newsletter/1998oct.html

you can also download the code from here:
http://www.geocities.com/SiliconValley/Lakes/4339/files/hook.zip

0
 

Author Comment

by:krydea
ID: 6376449
i realy men some thing like this lock the mouse and lets the compueter move and drop it<- mouse down.
if it's posible
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6376661
hello krydea, you can position (move) the cursor (mouse) and click it (or do 2 clicks for double click) with windows API  
mouse_event(dwFlags,dx,dy,dwData,dwExtraInfo);

0
 
LVL 33

Expert Comment

by:Slick812
ID: 6376666
I don't really understand your question very well, could you say what you want to do. . . . . like move cursor to X=246 and y=397, and double click a button there
0
 

Author Comment

by:krydea
ID: 6376704
yea..
0
 

Author Comment

by:krydea
ID: 6376716
Slick812 : can you give a example?lets say ye have to use 2 integer X and Y click there... is that pisible?
if so plz mail the app to my mail addrs: Krydea@hotmail.com
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 50 total points
ID: 6377657
yes it is posible, , , you can move the cursor to any place the your screen with - SetCursorPos(231,341) - and you click the screen where the cursor is with two mouse events, a left button down and a left button up-
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);

mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

 - - - - - - - - - - - -
here is a button click event that will move the cursor and then Click it once. - -

private
    { Private declarations }
    X, Y: Integer;

procedure TForm1.Button1Click(Sender: TObject);
begin
{set X and Y to the Pixel position you want the cursor "HotSpot" to be in}

SetCursorPos(X,Y);

mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);

mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
{repeat the 2 mouse_event to do a double Click}

end;

- - - - - - - - - - - - - - -

ask me if you need more info

0
 

Expert Comment

by:kyr
ID: 6377909
thanks for the info Slick812. i wasn't aware of this function.
0
 

Author Comment

by:krydea
ID: 6385255
hey thanx iw ill give you the point's now:)
but can you tell me if you know something about the keyboard?:p
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6386915
OK, I have done some Keyboard event code, but your question needs to ask for a certain thing about getting keyboard information. What is your problem ? or do you just need information ?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 33

Expert Comment

by:Slick812
ID: 6386950
if you are a beginer in delphi programming, you should get a book and follow the lessions to learn about using delphi
0
 

Author Comment

by:krydea
ID: 6387399
just information to send key's as i typ them now etc..
0
 

Author Comment

by:krydea
ID: 6387401
can you help me?
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6389180
"to send Keys" ? ? ? I do not understand this. can you give an example. like send keys to another TMemo when I am typing into a TMemo
0
 

Author Comment

by:krydea
ID: 6389504
yea your typing in to a memo or in to a edit in explorer  like typing into a ader programme.. is that posible?
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6391249
I have trouble understanding what you need, , , "a memo or in to a edit in explorer" does windows explorer have an edit or memo ? ? ? It is posible to get the keyboard "typing" even if your program does not have the keyboard focus, , , ,  "like typing into a ader programme" but you have to make a  .DLL  to get windows system keyboard output, because your program ONLY gets keyboard when it has "Focus", do you want me to Email you some Info about this? ? maybe you could explain more what you want to do
0
 

Author Comment

by:krydea
ID: 6391329
yea plz send me some info Krydea@hotmail.com.
k better explaning.
yea typing in to a memo would be fine.. so not set the text but put them as a mounsepost. look you send a message to windows and then he sets the mouse somewere you do that with SetCursorPos right it it posible that my programme sends key's..
example:
a programme we add a edit and a button when we click on the button the mouse moves to the edit and typs there something in but not with edit.lines.add or with edit.text but put the keys in it as you do with the SetCursorPos..

hope this is explaned better.
0
 

Author Comment

by:krydea
ID: 6391331
maybe you can call it keyboard control..?
0
 

Author Comment

by:krydea
ID: 6397758
hey men can you help me or not if you don't whant to help me just say it and don't let me waiting for mail from you or EE
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6398694
sorry I will send Email today, been busy here
0
 

Author Comment

by:krydea
ID: 6399737
k sorry for pusing..
0
 

Author Comment

by:krydea
ID: 6406881
hey,
i did my homework for is project the only thing i need to know is how to get the handel of the edit \ memo where my mouse is going over...
can't you only help me with that plz..

krydea
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now