Sign in to follow this  
Followers 0
Bailey

Visual Basic..

5 posts in this topic

Hello, I've been working on this application to automate things for a friend for awhile now, I am nearly done and coded it in VB.. at the time I started I wasnt aware of AutoIt, otherwise I'd probably have used it since it would have made things easier :think:

Anyways, theres this one application that Im trying to automate mouse clicks on, and it just doesnt work with my VB source, Ive posted on so many forums and tried so many different variations of mouse clicks.. anyways I couldnt find anything that worked aside from actually clicking it manually myself. Then when I found autoit I made a quick script and it worked.. I was wondering if theres anyway to use that script or an autoit dll or something to add it to my VB function? if not does anyone know how to make a mouse click in VB that works? Like I know how to click on x/y coords and it works, it just doesnt work on this one application, i know how to send mouseclicks to handles etc too, no idea, but it just wont work on this one application

I found the public autoit source which is in C++ and I was looking at the mouse down and mouse up functions and from what I could see aside from the code it uses to detect whether the mouse buttons are swampped its basically just

mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)

mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)

or am I missing something?

Anyways when I use that in VB it works on almost everything except this one application lol.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

oooh found more source.. source i was looking at before was for mousedown and mouseup.. theres seperate source for mouse click.. might be able to figure this out :think:

EDIT:

Ya I have no idea lol...

Edited by Bailey

Share this post


Link to post
Share on other sites

What is the offending application?

Share this post


Link to post
Share on other sites

I havent used VB in forever, and was never really beyond a beginner anyways, but maybe you could compile your AutoIt script, and just run the .exe at a certain point in your VB app? I know its a dirty workaround, but it should work.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Anyways, theres this one application that Im trying to automate mouse clicks on, and it just

doesnt work with my VB source [cut]

VB6 :

Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Type POINTAPI
    x As Long
    y As Long
End Type
Sub SpostaCenterScreen()
    Dim Posizione As POINTAPI
        Posizione.x = 779
        Posizione.y = 583
         SetCursorPos Posizione.x, Posizione.y 'sposta il cursore del mouse al centro dello schermo
End Sub


Private Sub Form_Load()
SpostaCenterScreen
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
''''''''''''''''SendKeys "x"
Unload Me
End Sub
Edited by Lapo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0