private void CaptureStartButton_Click(object sender, RoutedEventArgs e) { GlobalHookManager.FinalizeHooks(); this.WindowWidth = defaultWindowWidth; this.WindowHeight = defaultWindowHeight; this.NavigationService.GoBack(); }
private void CaptureStartButton_Click(object sender, RoutedEventArgs e) { GlobalHookManager.InitializeHooks(); ExecutingMode nextPage = new ExecutingMode(); this.SaveToExcelButton.IsEnabled = false; this.NavigationService.Navigate(nextPage); }
IntPtr _mouseHookWindowsHandle = IntPtr.Zero; //Int pointer to the Mouse hook //This constructor will handle the loading of the User32 Library which is the one that manages system hooks. public GlobalHookManager() { //Check if there's already an instance of this class, if there is throw an error. if (singleton != null) { throw new Exception("There's already another instance of GlobalHookManager! No need to create another one."); } _user32LibraryHandle = IntPtr.Zero; _user32LibraryHandle = DLLImports.LoadLibrary("User32"); if (_user32LibraryHandle == IntPtr.Zero) { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception(errorCode, $"Failed to load library 'User32.dll'. Error {errorCode}: {new Win32Exception(Marshal.GetLastWin32Error()).Message}."); } singleton = this; }