justcoding121 / windows-user-action-hook Goto Github PK
View Code? Open in Web Editor NEWA .NET library to subscribe for Windows operating system global user actions such mouse, keyboard, clipboard & print events
License: MIT License
A .NET library to subscribe for Windows operating system global user actions such mouse, keyboard, clipboard & print events
License: MIT License
title
Hello,
I am not able to capture print to PDF event. Can you please help?
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'
Subj.
OnApplicationWindowChange never fires, because ShellHook ignores all windows without WS_SYSMENU.
I think the logic in ShellHook.IsAppWindow deserves some explanation overall. For example, there's a check for IsWindowVisible, but it never tracks if window becomes visible after creation.
Perhaps, library user should be able to filter windows on their own.
How do Changed Key Code or Key press
In all the situations I have try to use the MouseWatcher inside a unit test, the testing framework (NUnit, xUnit) reports a this exception:
System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
First guess is that, calling MouseWatcher.Stop(), doesn't stop all the running threads that it should.
I have tried:
Nothing has worked yet. At the moment you call MouseWatcher.Start() you get the cited exception at the end of the test.
Thanks you.
Please sign the package before releasing on nuget.org
This is the window I want to hooked.
This is the result analysed by Spy++
I use the code about AppHook in README.MD, but I cannot see output about the MsgBox I want to hook.
This is the code I wrote following the demo in README.
If you can give me some advice or hints, I will be appreciate it, Thx !!!
Also I noticed what hook is not working when I'm using remote desktop (mstsc for example).
My app is a COM add-in for the VBE - it's basically hosted in a host (the VBE) that's itself hosted in a host (the VBA host app)... and add another host layer to that when I'm running it in the VS debugger.
Long story short, everything seems to work when I'm running in the VS debugger. But when it isn't (i.e. I just launch Excel and load the last build), bringing up the VBA editor stalls the Office host app, and one of my contributors has reported seeing this error message:
ContextSwitchDeadlock occurred
Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE'.
Additional information: The CLR has been unable to transition from COM context 0xfc79c8 to COM context 0xfc7910 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
I suspect I might need to somehow pass the VBE MainWindow's hWnd
to the EventHook
API, but can't be sure.
I don't understand why it works when the VS debugger is attached, and deadlocks when it isn't (actually that Managed Debugging Assistant message seems to imply a debugger was attached), but I've disabled all other hooks and the issue persists as long as I have EventHook
hooks attached; the issue resolves itself if I instead disabled the EventHook
hooks and leave mine (I have a TimerHook regularly checking if the VBE is the active window, and a Hotkey hook listening for WM_HOTKEY messages sent) - so I know for a fact that the problem is with EventHook
hooks.
How i can the mouse move event from being captured?
Repro:
Expected: closing message should appear
Actual: it does not
Side note: I made a trivial fix in a fork, but it might be not backwards-compatible, as with it you get lots of destroy events without much data.
Could you be so kind to give me a example of using your awesome library in VB.Net
Also could this library be used to globally catch the WM_PASTE hook.
So you can detect user paste not only by ctrl v but also by context menu
Thanks so much for this library and your work
It is needed "MouseMessages Enum" for wheelClick.
519 : WHEELCLICK_DOWN
520 : WHEELCLICK_UP
namespace EventHook.Hooks
{
public enum MouseMessages
{
WM_MOUSEMOVE = 512,
WM_LBUTTONDOWN = 513,
WM_LBUTTONUP = 514,
WM_RBUTTONDOWN = 516,
WM_RBUTTONUP = 517,
WM_WHEELBUTTONDOWN = 519,
WM_WHEELBUTTONUP = 520,
WM_MOUSEWHEEL = 522
}
}
I am trying the library with n console application and I can see all events except Application.
I tried firs 4.6.2 and then changed to 4.5 but did not work either.
No exception.
What other things I can check ?
My OS Win 140.
The master in my fork seems to be very diverged from the one in this repository, and same commits have different hashes...
Beautiful work! I think this library would be more complete if it also handled hotkeys; the API could intake a Keys
flag enum value for the key combination, and internally work out the applicable +^%
modifier string... or perhaps intake the hotkey string as an overload.
It also needs a way to identify hotkeys, without forcing a type on the client code - object
would work, but a generic type argument would be even better. Something like this:
var key = Keys.Ctrl + Keys.Shift + Keys.R;
// generic type parameter is inferred for Register<T>
HotkeyWatcher.Register(MyHotkeyEnum.SomeCoolCommand, key);
HotkeyWatcher.Start();
When a hotkey message is captured, an event is raised and the corresponding "key" that the hotkey was registered with is sent back to the client code, who can then decide what to do.
Note: I'll submit a PR soon-ish :-)
I make an application and i will ignore printscreen key and desktop capturing .
Is your package do it?
Hi,
I came across this SO post and noticed the update pointing to this repository.
I haven't tried it yet but at first sight this looks like a very useful project and with your permission I'll use it in my own OSS project, Rubberduck - I'm not very familiar with licenses and their interactions, but my project is under GPL3; would it be ok to use your work there?
I'd like to also give proper credit/attribution, so if that's ok with you I'll add your project to our "About" window alongside Antlr4, LibGit2Sharp and the other OSS projects Rubberduck is using, and I'll add a link to this repository in the attributions section of my readme file.
Cheers!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.