本文整理汇总了C#中LowLevelMouseProc类的典型用法代码示例。如果您正苦于以下问题:C# LowLevelMouseProc类的具体用法?C# LowLevelMouseProc怎么用?C# LowLevelMouseProc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LowLevelMouseProc类属于命名空间,在下文中一共展示了LowLevelMouseProc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetHook
private static IntPtr SetHook(LowLevelMouseProc proc)
{
using (Process currentProcess = Process.GetCurrentProcess())
{
using (ProcessModule currentModule = currentProcess.MainModule)
return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(currentModule.ModuleName), 0);
}
}
示例2: SetHook
/// <summary>
/// Get Current Process and Module and Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread
/// </summary>
/// <param name="proc">HookCallback</param>
/// <returns></returns>
public static IntPtr SetHook(LowLevelMouseProc proc)
{
using (var curProcess = Process.GetCurrentProcess())
using (var curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
}
}
示例3: Hook
public Hook(LowLevelMouseProc callback)
{
this._Callback = GCHandle.Alloc(callback);
if ((this._Handle = NativeMethods.SetWindowsHookExW(NativeMethods.WH_MOUSE_LL, Marshal.GetFunctionPointerForDelegate(callback), NativeMethods.GetModuleHandle(), 0)) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
示例4: SetHook
private static IntPtr SetHook(LowLevelMouseProc proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
IntPtr hook = SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle("user32"), 0);
if (hook == IntPtr.Zero) throw new System.ComponentModel.Win32Exception();
return hook;
}
}
示例5: SetHook
private IntPtr SetHook(LowLevelMouseProc proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
_proc = HookCallback;
return SetWindowsHookEx(WH_MOUSE_LL, _proc,
GetModuleHandle(curModule.ModuleName), 0);
}
}
示例6: SetWindowsHookEx
static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc callback, IntPtr hInstance, uint threadId);
示例7: MouseHook
public MouseHook()
{
//Install Hook, return handle to the hook procedure
llMouseProc = new LowLevelMouseProc(HookCallback);
_hookID = SetHook(llMouseProc);
}
示例8: MouseCapture
static MouseCapture()
{
s_hook = SetWindowsHookEx(WH_MOUSE_LL,
s_proc = new LowLevelMouseProc(HookProc),
System.Runtime.InteropServices.Marshal.GetHINSTANCE(typeof(MouseCapture).Module),
//GetModuleHandle(null),
0);
s_eventArgs = new MouseCaptureEventArgs();
AppDomain.CurrentDomain.DomainUnload += delegate
{
if (s_hook != IntPtr.Zero)
UnhookWindowsHookEx(s_hook);
};
}
示例9: SetHook
/*
* SetHook: attach a mouse movement listener to the current process
* @param LowLevelMouseProc proc: The mouse listener
* @return IntPtr: The hook
*/
private static IntPtr SetHook(LowLevelMouseProc proc)
{
// Attach to the current process
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_MOUSE_LL, proc,
GetModuleHandle(curModule.ModuleName), 0);
} // end using curProcess
} // end SetHook
示例10: SetHook
static IntPtr SetHook(LowLevelMouseProc proc)
{
IntPtr p = IntPtr.Zero;
try
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
p = SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
}
}
catch
{
}
return p;
}
示例11: SetHookMouse
private static IntPtr SetHookMouse(LowLevelMouseProc proc)
{
using (System.Diagnostics.Process curProcess = System.Diagnostics.Process.GetCurrentProcess())
using (System.Diagnostics.ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
}
}
示例12: MouseHook
public MouseHook()
{
callback = new LowLevelMouseProc(MouseCallback);
handle = Win32.SetWindowsHookEx(WH_MOUSE_LL, callback, IntPtr.Zero, 0);
}
示例13: MainWindow
public MainWindow()
{
_proc = HookCallback;
_hookId = SetHook(_proc);
//Application.Run();
_timer.Interval = 1;
_timer.Tick += _timer_Tick;
InitializeComponent();
_timer.Start();
_area = Screen.PrimaryScreen.WorkingArea;
_world = new World(new Vector2(0, 9.8f));
// Farseer expects objects to be scaled to MKS (meters, kilos, seconds)
// 1 meters equals 64 pixels here
ConvertUnits.SetDisplayUnitToSimUnitRatio(64f);
/* Circle */
// Convert screen center from pixels to meters
Vector2 circlePosition = ConvertUnits.ToSimUnits(new Vector2((float)_area.Width/2, (float)_area.Height/2));
Left = (float)_area.Width/2 - (Width/2);
Top = (float) _area.Height/2 - (Height/2);
// Create the circle fixture
_circleBody = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(100 / 2f), 10f, circlePosition);
_circleBody.BodyType = BodyType.Dynamic;
_circleBody.ApplyTorque(500f);
// Create the ground fixture
_groundBody = BodyFactory.CreateRectangle(_world, ConvertUnits.ToSimUnits(_area.Width*4),
ConvertUnits.ToSimUnits(1f), 1f,
ConvertUnits.ToSimUnits(new Vector2(_area.Width/2, _area.Height)));
_groundBody.IsStatic = true;
_groundBody.Restitution = 0.8f;
_groundBody.Friction = 0.5f;
// Create east wall
_groundBody2 = BodyFactory.CreateRectangle(_world, ConvertUnits.ToSimUnits(1f),
ConvertUnits.ToSimUnits(_area.Height), 1f,
ConvertUnits.ToSimUnits(new Vector2(_area.Width * 2 - 50,
_area.Height)));
_groundBody2.IsStatic = true;
_groundBody2.Restitution = 0.8f;
_groundBody2.Friction = 0.5f;
}
示例14: KeyboardMouseHook
public KeyboardMouseHook(KeyboardEventHandler eventKeyDown)
{
//Create an event using a delegate to fire whenever data is received by the hook
myEventKeyOrMouse = eventKeyDown;
_Keyboardproc = KeyboardHookCallback;
_KeyboardhookID = SetKeyboardHook(_Keyboardproc);
_Mouseproc = MouseHookCallback;
_MousehookID = SetMouseHook(_Mouseproc);
Modifiers = KeyModifiers.None;
}
示例15: ActivateHook
public void ActivateHook()
{
HookHandleFct = HookHandle;
IntPtr hInstance = LoadLibrary("User32");
Hook = SetWindowsHookEx(WH_MOUSE_LL, HookHandleFct, hInstance, 0);
}