
How do I capture mouse and keyboard events?
1. The Win32API Reference Help File says like this:
The system hooks are a shared resource, and installing one affects all
applications. All system hook functions must be in libraries. System hooks
should be restricted to special-purpose applications or to use as a
development aid during application debugging.
2. There is no hWnd param for SetWindowsHookEx... Declare for
SetWindowsHookEx:
Public Declare Function SetWindowsHookEx Lib "user32" Alias
"SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As
Long, ByVal dwThreadId As Long) As Long
There is no hWnd param...
Quote:
> 1. Can you explain why I have to use a DLL?
> 2. What do I use for the hWnd when I call SetWindowsHookEx? The hWnd for
the
> desktop?
> > You need to use the SetWindowsHookEx API. But as you want the hook to be
> > system wide, you have to place the callback routine in a DLL, and as
you
> > probably know, you cant make dlls in VB.. You will need to make a dll in
> C++
> > or Delphi or something like that. But im sure you will find some dll on
> the
> > net...
> > > I want to write a specilized Windows macro recorder. I need an API
> > function
> > > or control that will signal my program whenver a mouse event occurs
> (along
> > > with the coordinates), and when keyboard events occur(along with the
key
> > > number) anywhere on the screen. Is there an API function, or control
> for
> > > this purpose?