Commit 9db81128 authored by Alexander Krause's avatar Alexander Krause

still heavy WIP

parent 66d019e0
......@@ -17,6 +17,11 @@ namespace ExplorVizGestureControl.Gestures
{
public class DiscreteGestureDetector
{
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lp1);
// import the function in your class
[DllImport("User32.dll")]
static extern int SetForegroundWindow(IntPtr point);
......@@ -113,25 +118,31 @@ namespace ExplorVizGestureControl.Gestures
case "Start_Reset":
if (contDetStartReset.busy) return;
contDetStartReset.startTimer();
/* sendKey(1,true);
Thread.Sleep(150);
sendKey(1, false);*/
/* sendKey(1,true);
Thread.Sleep(150);
sendKey(1, false);*/
try
{
Process p = Process.GetProcessesByName("chrome")[0];
if (p != null)
Process[] Processes = Process.GetProcessesByName("chrome");
IntPtr hWnd = IntPtr.Zero;
Debug.Write("Processes: " + Processes.Length + "\n");
foreach (Process p in Processes)
{
IntPtr h = p.MainWindowHandle;
SetForegroundWindow(h);
SendKeys.Send("{UP}");
Debug.Write("Processes: " + p + "\n");
// do something
hWnd = p.MainWindowHandle;
//SetForegroundWindow(hWnd);
//SendKeys.Send("{UP}");
}
}
catch (System.InvalidOperationException)
catch (System.InvalidOperationException ex)
{
Console.WriteLine("catched send keys exception");
Console.WriteLine(ex.ToString());
}
ContinuousGestureDetector.delayTimer.startTimer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment