private void mouseHook_LeftButtonDown(WinAPI.MSLLHOOKSTRUCT mouseStruct) { if (wndPinballBrowser == IntPtr.Zero) { wndPinballBrowser = WinAPI.WindowFromPoint(mouseStruct.pt); btnStartStop.Enabled = true; HookEnabled = false; mouseHook.Uninstall(); } }
private void mouseHook_LeftButtonUp(WinAPI.MSLLHOOKSTRUCT mouseStruct) { // Wait for the pinball browser window to be updated Thread.Sleep(100); if (wndPinballBrowser != IntPtr.Zero && WinAPI.IsWindow(wndPinballBrowser)) { // Get the capture window rectangle WinAPI.RECT wndRect = new WinAPI.RECT(); WinAPI.GetWindowRect(wndPinballBrowser, out wndRect); // Capture only if mouse is on the advance frame button in Pinball Browser if (mouseStruct.pt.x >= (wndRect.X + 246) && mouseStruct.pt.y >= (wndRect.Y - 72) && mouseStruct.pt.x <= (wndRect.X + 246 + 17) && mouseStruct.pt.y <= (wndRect.Y - 72 + 24)) { Import(); } } }