Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Forcing a mouse click? - user32.dll

Author
Message
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 9th Sep 2005 14:10
I'm trying to make a program that clicks the mouse repeatedly. I've come up with the following code below but I don't fully understand what parameters I should be using in the dll or what to set them to. I've found c++ snippets on how to do it but I'm not sure how to convert it over to DBPro. Anyway here's my code so far, can anyone help?




Here's a link to the function at microsoft
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputfunctions/mouse_event.asp

CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Sep 2005 14:58
the named arguments might be enumerated constants so you can look those up and pass in numeric values (like for MOUSEEVENTF_LEFTDOWN and MOUSEEVENTF_LEFTUP) also youll need to specify mouse x and y coords. Maybe get these from dbp if you want the actual location of the mouse, or hard code them if you need to specify some actual location that the mouse isnt really at.

not sure tho

DBP Plugins | EZ_Serv 1.5 Bush, a retard, son of an *sshole
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 9th Sep 2005 16:16
Thanks for the reply cattle rustler but I don't know what numeric values to pass in though. When you say enumerated constants do you mean using something like the following (taken from a blueGUI file)

#constant RIGHTBUTTON_UP 0x205

I have no idea what that value is or where to get it from. I've never even used the constant command before This is pretty much new territory for me.

Ok I did some searching and found that 2 and 4 seem to be the values I need to use for down and up. Which I got from this link

http://www.borg.com/~jglatt/rexx/scripts/gci/mousesim.rex

call dll 1,"mouse_event",2,0,0,0,0
call dll 1,"mouse_event",4,0,0,0,0

Don't fully understand what's going on but at least I got it working.


CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Sep 2005 21:57 Edited at: 9th Sep 2005 21:57
great, thats exactly what I meant by enumerated constants. Theres a type in most programming languages called an Enum. It holds a list of items as a certain type and enumerates the entries. A simple example would be

Public Enum TestValues() as Integer
False
True
End Enum

in this example Testvalues.False equates to the integer value 0 (zero), true would equate to 1. So when MS said MOUSEEVENTF_LEFTDOWN and MOUSEEVENTF_LEFTUP, they were really saying integer 2 and integer 4 from inside an enum in the API.

hope that helps. glad its working.

DBP Plugins | EZ_Serv 1.5 Bush, a retard, son of an *sshole
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 10th Sep 2005 01:12
I think I understand what your saying but how am I supposed to know that MOUSEEVENTF_LEFTDOWN is equal to 2 when calling the dll. Is there anyway? The page explaining the function on the microsoft page doesn't give that info. I got my program finished though. It's my smallest and probably most complete program ever. It's just a simple auto clicker but if you want to check it out here's the link.

http://www.teamxtcgames.com/files/autoclicker.rar 240kb

empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 10th Sep 2005 17:51
Quote: "but how am I supposed to know that MOUSEEVENTF_LEFTDOWN is equal to 2 when calling the dll."

Most of the "major languages" deliver all those WinAPI constants in a library. C and C++ as header files, Delphi and Freepascal in the Windows and Messages unit. Surprisingly VB 6 (don't know about .Net) doesn't seem to have them. That's good for you though cause there are lots of web sites with code snippets that show how those constants are defined. So for example google:
"Const MOUSEEVENTF_LEFTDOWN" (with quotes) and the first result says
Const MOUSEEVENTF_LEFTDOWN = &H2
in VB &H is the prefix for hex (irrelevant in this case but still...)
Seems to work for most windows constants.


Play Nice! Play Basic! Version 1.088
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 10th Sep 2005 21:29
Yeah I came accross MOUSEEVENTF_LEFTDOWN = &H2 and didn't know what it meant. I was pretty sure it wouldn't work in DBPro so I kept searching. Thanks for the advice empty.

Login to post a reply

Server time is: 2024-05-06 00:13:45
Your offset time is: 2024-05-06 00:13:45