As the title suggests, I want to get a mouse over event at the corners of desktop. I tried to do it by getting the position of the mouse and polling it continuously to check if it is one of the edge coordinated and then trigger the event but I think thats bad way to do it. I tried to use the library MouseKeyHook but it wasn't useful for me to generate the necessary event.
Is there any better way to get mouse over events to the corners of the screen ?
I tried to improve the code by adding the following, but for some reason the mouse over to the corners isn't triggering the action.
public async void callMainLoop() {
var slowTask = Task<Boolean>.Factory.StartNew(() => mainMethodLoop(GetMousePosition()));
await slowTask;
}
public bool mainMethodLoop(Point point) {
while (true) {
double xRes = System.Windows.SystemParameters.PrimaryScreenWidth - 1;
double yRes = System.Windows.SystemParameters.PrimaryScreenHeight - 1;
if (point.X == 0 && point.Y == 0) {
if (comboBox0.SelectedItem != null) {
executeAction(comboBox0.SelectedItem.ToString());
return true;
}
}
return false;
}
}
I am not calling this in the constructor, there ins't any freezing now.