protected override HookHandle Subscribe() { return(HookHandle.Create( HookType.AppMouse, HookProcedure, IntPtr.Zero, ThreadNativeMethods.GetCurrentThreadId())); }
public static string GetActiveWindowTitle() { StringBuilder sbTitle = new StringBuilder(1024); ThreadNativeMethods.GetWindowText(ThreadNativeMethods.GetForegroundWindow(), sbTitle, sbTitle.Capacity); string title = sbTitle.ToString(); return((!string.IsNullOrEmpty(title)) ? title : null); }
// Token: 0x060002FB RID: 763 RVA: 0x0000F15C File Offset: 0x0000D35C public static string smethod_7() { StringBuilder stringBuilder = new StringBuilder(1024); ThreadNativeMethods.GetWindowText(ThreadNativeMethods.GetForegroundWindow(), stringBuilder, stringBuilder.Capacity); string text = stringBuilder.ToString(); if (string.IsNullOrEmpty(text)) { return(null); } return(text); }
private static HookResult HookApp(int hookId, Callback callback) { _appHookProc = (code, param, lParam) => HookProcedure(code, param, lParam, callback); var hookHandle = HookNativeMethods.SetWindowsHookEx( hookId, _appHookProc, IntPtr.Zero, ThreadNativeMethods.GetCurrentThreadId()); if (hookHandle.IsInvalid) { ThrowLastUnmanagedErrorAsException(); } return(new HookResult(hookHandle, _appHookProc)); }