473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to find my information

At the moment I wish to figure out how to perform a mouse click at a
given position on the screen.

Someone probably has the solution, but I rather want to learn to find
out myself.

So, could someone push me in the right direction, as how to retrieve
the information from MSDN?

I know I should be using the an API of user32.dll, but besides that I
find it difficult to know what to find where. Any thumb-rules I can
take into consideration?

Where is the right place / search routine, when I wish to find out of
API's e.g. in connection with mouse and keyboard activity?

Regards /Snedker
Oct 9 '06 #1
5 1008
hi, check out www.allapi.net, they have a great library of API functions,
plus VB examples of almost all of them. theyve been very helpful to me in
giving good information for API calls.
--
-iwdu15
Oct 9 '06 #2
Rather than using MSDN, I have better success using Google to search
the web and groups for this kind of thing.

Picking the right search terms, that will give you what you want
without being too broad or limiting, is the trick. You know you want
to perform a specific task. You know it will involve an API call;
which, since you're doing it in VB, will require a Declare. So, for
your query, try something like:

simulate mouse click declare

And I guarantee you'll find it quickly. :)

Oh, one more hint. There's more than one way to do it. Even a way
that doesn't require moving the mouse pointer at all, if that's
something you're interested in.

Oct 10 '06 #3
On 9 Oct 2006 19:20:51 -0700, te******@hotmail.com wrote:

>Oh, one more hint. There's more than one way to do it. Even a way
that doesn't require moving the mouse pointer at all, if that's
something you're interested in.
Hit me! :-)

/Snedker
Oct 10 '06 #4
Morten Snedker wrote:
Hit me! :-)
It's been a long time since I've done this, but it involves sending the
Windows messages directly to the control that it would normally
receive.

First, you need the handle (hWnd) of the control:

1) Get the visible control for a given screen location using API
WindowFromPoint (easy), or
2) Call API GetWindow recursively to search for a control by
WindowName/ClassName/Text (harder, but you can "click" things not even
visible)

Then, use API PostMessage to send the appropriate messages to that
hWnd. You can see the messages that a control receives during normal
mouse/keyboard interaction by using a tool like WinSpy to intercept and
display them.

Here's where my memory gets a bit fuzzy. If I recall, a few controls
will respond just fine to a single WM_CLICK message, but most prefer a
WM_LBUTTONDOWN followed by a WM_LBUTTONUP. I found some code in an old
VB6 program of mine, and removed the non-relevant stuff; this should at
least give you the idea:

-----

Private Type LongInt
lng As Long
End Type
Private Type LoHiWord
lw As Integer
hw As Integer
End Type

Sub LeftClickAt(ByVal hWnd as Long, ByVal X as Long, ByVal Y as Long)
' virtual click left mouse button (I think X/Y were control
coordinates, not screen)
SendMouseEvent hWnd, WM_MOUSEMOVE, X, Y
SendMouseEvent hWnd, WM_LBUTTONDOWN, X, Y
SendMouseEvent hWnd, WM_LBUTTONUP, X, Y
SendMouseEvent hWnd, WM_MOUSEMOVE, X, Y
End Sub

Private Function SendMouseEvent(ByVal hWnd As Long, ByVal lMsg As Long,
ByVal nX As Long, ByVal nY As Long) As Long
' Sends a virtual mouse message directly to a window.
Dim l1 As Long
Dim li As LongInt
Dim lhw As LoHiWord
lhw.lw = nX
lhw.hw = nY
LSet li = lhw
SendMouseEvent = PostMessage(hWnd, lMsg, ByVal l1, ByVal li.lng)
End Function

-----

Let me know if you get stuck and I'll dig up some more info.

Oct 10 '06 #5
On 10 Oct 2006 14:40:52 -0700, te******@hotmail.com wrote:

Your help is mostly appreciated. I'll give it at go along the day and
let you know how it went. Thanks again.

Regards /Snedker

Oct 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then...
25
by: Tor Erik Sønvisen | last post by:
Hi I need to browse the socket-module source-code. I believe it's contained in the file socketmodule.c, but I can't locate this file... Where should I look? regards tores
2
by: dskillingstad | last post by:
I'm building a tracking system and I'm having some problems. I thought this was relatively easy, but.... I have the following tables and fields (abbreviated): tblPermitMain PermitID - pk...
1
by: John A Grandy | last post by:
Visual Studio 2005 RC. I create my first ASP.NET 2.0 Web Site at c:\code\my-app , and when I attempt to compile I receive about 30 errors related to the compiler not being able to find schema...
0
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency...
0
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
0
by: jhansen | last post by:
I am getting informational warnings about the following app.config and indicate the following. I am using C# visual studio 2005 and used the Settings.settings to set up my values scoped as...
8
by: erick-flores | last post by:
Hello all My code used to work, but now its not working any more. What I am trying to do is find the current user when a forms open. This is the code that used to work: If...
14
by: inpuarg | last post by:
I want to find a & character using Regex. But not && How can i manage this in c# Quickfind window ? -------------------------------------------------- ne kadar yaşarsan yaşa sevdiğin kadardır...
2
AmberJain
by: AmberJain | last post by:
Hello, The question itself is quite explanatory. My current PC configuration consists of 256 MB RAM and I am planning to upgrade to 1 or 2 GB RAM. So how can I find the amount of RAM my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.