Skip to content

Commit

Permalink
Use of VolumeMute key for window detection
Browse files Browse the repository at this point in the history
Fixes issue UnlimitedStack#15
Added delay between keys because It just did not work twice in a row.
  • Loading branch information
Azurac committed Sep 19, 2022
1 parent 058c6de commit 38d43f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions HideVolumeOSD/HideVolumeOSDLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public void Init()

while (hWndInject == IntPtr.Zero && count < 9)
{
keybd_event((byte)Keys.VolumeUp, 0, 0, 0);
keybd_event((byte)Keys.VolumeDown, 0, 0, 0);
keybd_event((byte)Keys.VolumeMute, 0, 0, 0);
System.Threading.Thread.Sleep(10);
keybd_event((byte)Keys.VolumeMute, 0, 0, 0);

hWndInject = FindOSDWindow(true);

Expand Down Expand Up @@ -143,8 +144,9 @@ public void ShowOSD()

// show window on the screen

keybd_event((byte)Keys.VolumeUp, 0, 0, 0);
keybd_event((byte)Keys.VolumeDown, 0, 0, 0);
keybd_event((byte)Keys.VolumeMute, 0, 0, 0);
System.Threading.Thread.Sleep(10);
keybd_event((byte)Keys.VolumeMute, 0, 0, 0);

if (ni != null)
ni.Icon = Resources.Icon;
Expand Down

0 comments on commit 38d43f4

Please sign in to comment.