Click to See Complete Forum and Search --> : keyboard events and mouse events?
r00d0034
August 19th, 2002, 07:20 AM
how to get point(x,y) where mouse click on desktop window
how to capture mouse events which will tell its position ,what button click etc.
is there any interrupt service of mouse where we can write our procedure ? to get mouse event info?
same for keborad ?
dbowler
September 12th, 2002, 08:37 PM
This question really addresses fundamental Windows programming. Windows programming is "event driven". What happens is that as events like key presses, mouse movements, mouse button clicks, etc are performed by the user, messages are queued to the appropriate applications for processing.
Since your question reveals that you know very little about the Windows programming paradigm, I suggest you get a good book on the subject and approach it from scratch. Depending on your background and talent, it can be a pretty steep learning cuve. But if you are a professional-level engineer, I'm sure you can get it under your belt. Be forwarned, it isn't something you can pick up in a weekend.
Good luck. =)
EDIT: In re-reading this the day after, it occurs to me that you may not be talking about Microsoft Windows at all. I guess my own history is showing through the assumptions I make. Except for some work very early on in the "mouse age", all my experience coding for mouse has bee in Microsoft Windows. I suggest you post what your own environment is. You may get more response that way.
bubu
September 15th, 2002, 04:14 PM
If you want the stuff for Windows, then i'm your salvation.
I've been building a info-stealer to steal info from people's computer and I implemented a system of capturing mouse and keyboard events. I even could capture (for example) for how much milliseconds have the SHIFT key been pressed. I code it in Visual Basic and compiled in Visual Basic 6.
Listen, dbowler is right. I'll not give you the source-code ready because you wouldn't know how to use it. Instead, I will tell you how and you'll have to find and waste your weeks of study just like I did (hope you learn faster than me).
To do what you want, you will have to use Windows APIs. If I'm right, API means Aplication Programming Interface, and with them you can do all sort of things in Windows. Bellow is a list of APIs related to your quest. Enjoy studying them in your next weeks. I'm sure isn't impossible because i'm 17 years old and i've been learning programming by myself for the last 7 years:
Note: This apis are for Visual Basic but if you work on them you can use them in any programming language that supports Windows APIs.
' Gets keyboard pressed keys.
Public Declare Function _
GetAsyncKeyState _
Lib "user32" _
(ByVal vKey As Long) As Integer
' Get CapsLock, NumLock or ScrollLock key state.
Public Declare Function _
GetKeyState _
Lib "user32" _
(ByVal nVirtKey As Long) As Integer
' Use to calc the period of time some keys are pressed.
Public Declare Function _
GetTickCount _
Lib "kernel32" () As Long
' Use to pause the keylogger for some millisecounds.
Public Declare Sub _
Sleep _
Lib "kernel32" _
(ByVal dwMilliseconds As Long)
' Used to get mouse position when a mouse button click is detected.
Public Declare Function _
GetCursorPos _
Lib "user32" _
(lpPoint As PointAPI) As Long
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.