Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

capturing mouse event with a formless application

Posted on 2001-09-18
9
Medium Priority
?
193 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:tomkyn
ID: 6491546
Excellent, just what I needed.
0
 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

597 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