我在我的 Form1 顶部做了:
using Gma.UserActivityMonitor;
然后宣布:
Gma.UserActivityMonitor.GlobalEventProvider actHook = new GlobalEventProvider();
然后在 Load 事件中我做了:
actHook.MouseClick += actHook_MouseClick;
然后在底部:
private void actHook_MouseClick(object sender, MouseEventArgs e)
{
if (e.Clicks > 0)
{
MessageBox.Show("hi");
}
}
但是,一旦我在加载任何内容之前的一秒钟后运行我的应用程序,我就会在文件上遇到异常:HookManager.Callbacks.cs
在线的:
throw new Win32Exception(errorCode);
异常:找不到指定的模块
System.ComponentModel.Win32Exception was unhandled
HResult=-2147467259
Message=The specified module could not be found
Source=ScreenVideoRecorder
ErrorCode=-2147467259
NativeErrorCode=126
StackTrace:
at Gma.UserActivityMonitor.HookManager.EnsureSubscribedToGlobalMouseEvents() in d:\C-Sharp\ScreenVideoRecorder\ScreenVideoRecorderWorkingVersion\HookManager.Callbacks.cs:line 236
at Gma.UserActivityMonitor.HookManager.add_MouseClick(MouseEventHandler value) in d:\C-Sharp\ScreenVideoRecorder\ScreenVideoRecorderWorkingVersion\HookManager.cs:line 69
at Gma.UserActivityMonitor.GlobalEventProvider.add_MouseClick(MouseEventHandler value) in d:\C-Sharp\ScreenVideoRecorder\ScreenVideoRecorderWorkingVersion\GlobalEventProvider.cs:line 71
at ScreenVideoRecorder.Form1.Form1_Load(Object sender, EventArgs e) in d:\C-Sharp\ScreenVideoRecorder\ScreenVideoRecorderWorkingVersion\Form1.cs:line 47
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
找不到什么或哪个模块?
我下载了版本 2 的源代码。并添加了来自硬盘上的 Gma.UserActivityMonitor 目录的所有文件 .cs。
我没有收到缺少某些东西的错误,那会是什么?