public MouseHook(ILog log) { logger = log; mouseHookProc = null; mouseHookHandler = IntPtr.Zero; deviceStateChecker = new WindowsInputDeviceStateAdaptor(); inputSimulator = new InputSimulator(); hInstance = ApiFunctions.LoadLibrary("User32"); }
/// <summary> /// Loads and gets the pinvoke kernel32 library. /// </summary> /// <param name="libraryName">Name of the library.</param> /// <returns>The library handler</returns> public IntPtr LoadPInvokeKernel32Library(string libraryName) { try { var libraryHandle = ApiFunctions.LoadLibrary(libraryName); return(libraryHandle); } catch (Exception ex) { logger.Error($"LOAD USER32 LIBRARY ERROR: {ex.StackTrace}"); return(IntPtr.Zero); } }