Solved

capturing mouse event with a formless application

Posted on 2001-09-18
9
171 Views
Last Modified: 2010-05-02
How do I capture a mouse event (move, click, yadda yadda yadda) in an application which doesn't have a form?
0
Comment
Question by:tomkyn
  • 6
  • 3
9 Comments
 
LVL 4

Expert Comment

by:wileecoy
ID: 6491486
Basically you will be using some API calls to get the position of the mouse and capture the events.

The solution depends on the scope of your question.

Are you trying to get the events over certain apps or any clicking of the mouse?

Wileecoy.
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6491508
The following will get the mouse coordinates:

Add the following Form1(default form), Text1(default textbox), Timer1(default timer)

Private Type POINTAPI
    X As Long
    Y As Long
End Type


Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long


Private Sub Timer1_Timer()

Dim Pt As POINTAPI

    GetCursorPos Pt
    Text1.Text = "X: " & Pt.X & "   Y: " & Pt.Y

End Sub
0
 
LVL 4

Accepted Solution

by:
wileecoy earned 100 total points
ID: 6491515
This link may also be of assistance to you.

http://www.planetsourcecode.com/xq/ASP/txtCodeId.2795/lngWId.1/qx/vb/scripts/ShowCode.htm


hth.

Wileecoy.
0
 
LVL 1

Author Comment

by:tomkyn
ID: 6491546
Excellent, just what I needed.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Author Comment

by:tomkyn
ID: 6491579
I can get the coordinates now.  Can I also capture the click event?  In other words, can I pop up a msgbox from my app when I click (regardless of where on the screen I click) the mouse button?
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6491636
... digging ...
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6491663
I will have to get back to you later in the evening - Can't find anything here.

Wileecoy.
0
 
LVL 1

Author Comment

by:tomkyn
ID: 6491718
Heh...  

Private Declare Function Getasynckeystate Lib "user32" Alias "GetAsyncKeyState" (ByVal VKEY As Long) As Integer

and the VKEY is &H1  :)
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6491859
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

17 Experts available now in Live!

Get 1:1 Help Now