本文整理汇总了C#中LowLevelKeyboardProc类的典型用法代码示例。如果您正苦于以下问题:C# LowLevelKeyboardProc类的具体用法?C# LowLevelKeyboardProc怎么用?C# LowLevelKeyboardProc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LowLevelKeyboardProc类属于命名空间,在下文中一共展示了LowLevelKeyboardProc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Freezeform
public Freezeform()
{
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
objKeyboardProcess = new LowLevelKeyboardProc(captureKey);
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0);
InitializeComponent();
}
示例2: frmRemote
public frmRemote()
{
InitializeComponent();
Text = "FreeRDC - " + HostID;
bgMonitor = new BackgroundWorker() { WorkerSupportsCancellation = true };
//Get Current Module
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
//Assign callback function each time keyboard process
objKeyboardProcess = new LowLevelKeyboardProc(CaptureKey);
//Setting Hook of Keyboard Process for current module
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0);
}
示例3: SetHook
private static IntPtr SetHook(LowLevelKeyboardProc proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
}
}
示例4: AutoTyper
/// <summary>
/// Default constructor
/// </summary>
/// <param name="autoTypedText">List of autotyped text</param>
public AutoTyper(string[] autoTypedText)
{
for (int i = 0; i < Math.Min(autoTypedText.Length, this.AutoTypedText.Length); i++)
{
this.AutoTypedText[i] = autoTypedText[i];
}
_proc = new LowLevelKeyboardProc(HookCallback);
_hookId = SetHook(_proc);
}
示例5: Hook
public Hook(LowLevelKeyboardProc callback)
{
this._Callback = GCHandle.Alloc(callback);
if ((this._Handle = NativeMethods.SetWindowsHookExW(NativeMethods.WH_KEYBOARD_LL, Marshal.GetFunctionPointerForDelegate(callback), NativeMethods.GetModuleHandle(), 0)) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
示例6: MainWindow
//*****************************************************************************************/
/**
* Constructor
* */
public MainWindow()
{
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule; //Get Current Module
objKeyboardProcess = new LowLevelKeyboardProc(captureKey); //Assign callback function each time keyboard process
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0); //Setting Hook of Keyboard Process for current module
InitializeComponent();
Init();
}
示例7: SetHook
private static IntPtr SetHook(LowLevelKeyboardProc lowLevelKeyboardProc)
{
using (var currentProcess = Process.GetCurrentProcess())
{
using (var mainModule = currentProcess.MainModule)
{
return SetWindowsHookEx(WhKeyboardLl, lowLevelKeyboardProc, GetModuleHandle(mainModule.ModuleName), 0);
}
}
}
示例8: SetHook
public IntPtr SetHook(LowLevelKeyboardProc proc)
{
_addKey = AddKeyPress;
using (var currentProcess = Process.GetCurrentProcess())
using (var currentModule = currentProcess.MainModule)
{
return SetWindowsHookEx(WhKeyboardLl, proc,
GetModuleHandle(currentModule.ModuleName), 0);
}
}
示例9: SetHook
public void SetHook(Action<int> hook)
{
if (Set)
{
return;
}
Hook = hook;
Set = true;
_proc = new LowLevelKeyboardProc(HookCallback);
_hookID = SetHook(_proc);
}
示例10: ClioGUI
public ClioGUI()
{
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
objKeyboardProcess = new LowLevelKeyboardProc(captureKey);
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0);
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
//this.TopMost = true;
}
示例11: BeginCapture
public static void BeginCapture()
{
s_proc = new LowLevelKeyboardProc(HookProc);
s_hook = SetWindowsHookEx(WH_KEYBOARD_LL,
s_proc,
GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName),
0);
AppDomain.CurrentDomain.DomainUnload += delegate
{
if (s_hook != IntPtr.Zero)
UnhookWindowsHookEx(s_hook);
};
}
示例12: KeyboardHook
private KeyboardHook(KeyboardShortcut shortcut, Action callback)
{
_shortcut = shortcut;
_callback = callback;
// ReSharper disable once RedundantDelegateCreation
_proc = new LowLevelKeyboardProc(HookCallback);
using (var curProcess = Process.GetCurrentProcess())
{
using (var curModule = curProcess.MainModule)
{
_hookID = SetWindowsHookEx(WH_KEYBOARD_LL, _proc, GetModuleHandle(curModule.ModuleName), 0);
}
}
}
示例13: Form1
public Form1()
{
trackLastTypedTime();
InitializeComponent();
_proc = HookCallback; //Moved this from the fields to inside the constructor...
//so I could change all the methods trying to change the non-static
//secondsSinceLastTyped label to non-static methods.
applicationEnabled = true;
makeEmptyDataGridView();
//InitializeMyScrollBar();
//notifyIcon = new NotifyIcon();
//notifyIcon.Visible = true;
//notifyIcon.Icon = SystemIcons.Application;
//-------Keylogging stuff------------
//var handle = GetConsoleWindow();
//// Hide
//ShowWindow(handle, SW_HIDE);
//These lines are neccesary for the printing of keys pressed to the console
_hookID = SetHook(_proc);
Application.Run(this);
UnhookWindowsHookEx(_hookID);
//-------End Keylogging stuff------------
//typedChars = ""; //initialize typedChars to empty string
}
示例14: GlobalHotkey
internal GlobalHotkey(HandleKeyDown handleKeyDown, Keys key, Keys modifiers)
{
keyHandleKeyDown = handleKeyDown;
watchKey = key;
watchModifers = modifiers;
proc = HookCallback;
hookId = SetHook(proc);
}
示例15: KeyInterceptor
public KeyInterceptor()
{
Task.Run(() => {
_proc = HookCallback;
_hookID = SetHook(_proc);
Application.Run();
});
}