Skip to content

Commit

Permalink
Added check to ensure window hook isn't overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenJDH committed Apr 30, 2019
1 parent 7efb7f8 commit 7bee76a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion QTemplates/Classes/KeyboardSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ public KeyboardSimulator()

public bool HookWindow()
{
_foregroundHWnd = GetForegroundWindow();
// If template selection window is closed, capture handle.
if (_foregroundHWnd == IntPtr.Zero)
{
_foregroundHWnd = GetForegroundWindow();
}

return IsWindow(_foregroundHWnd);
}

Expand Down

0 comments on commit 7bee76a

Please sign in to comment.