Skip to content

Commit

Permalink
Fix first SetForeground
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Mar 12, 2020
1 parent 93e8909 commit 4e2ce5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Lurker/Helpers/KeyboardHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Lurker.Helpers
{
using System;
using System.Threading;
using WindowsInput;

public class KeyboardHelper
Expand Down Expand Up @@ -77,8 +78,11 @@ public void Search(string searchTerm)
protected void SendCommand(string command)
{
lock (CommandLock)
{
{
// This is to fix the first SetForegroundWindow
this._simulator.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LMENU);
Native.SetForegroundWindow(this._windowHandle);

this._simulator.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN);
this._simulator.Keyboard.ModifiedKeyStroke(WindowsInput.Native.VirtualKeyCode.CONTROL, WindowsInput.Native.VirtualKeyCode.VK_A);

Expand Down

0 comments on commit 4e2ce5d

Please sign in to comment.