So i'm writing a little tool to have a bit easier access to functions because there are no hotkeys.
For now i use global hotkeys to move my mouse to specific locations on the monitor and perform r/l clicks.
KeyboardHook hook = new KeyboardHook();
hook.KeyPressed +=
new EventHandler<KeyPressedEventArgs>(hook_KeyPressed);
hook.RegisterHotKey(TestBox.ModifierKeys.Control, Keys.D1);
void hook_KeyPressed(object sender, KeyPressedEventArgs e)
{
Process[] p = Process.GetProcessesByName(".......");
if (p.Count() > 0)
SetForegroundWindow(p[0].MainWindowHandle);
RightMouseClick(2000,110);
System.Threading.Thread.Sleep(200);
LeftMouseClick(2060,120);
}
So far so good. Now my problem:
The coordinates are the ones from my right monitor (triple setup). But what if i decide to switch the programm to my left monitor? Then the coordinates wont match anymore. My way would be something like this, but i don't know how to start and implement this.
If you first press the hotkey, there is a check for coordinates. If not -> ask to set them. User then moves mouse to first point and press F2, move to second point and press F2 again. So the coordinates get saved and the hotkey can be performed.