Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions HideVolumeOSD/HideVolumeOSDLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private struct RECT

IntPtr hWndInject = IntPtr.Zero;

VolumePoup volumePopup = new VolumePoup();
VolumePoup volumePopup;

System.Windows.Forms.Timer hideTimer = new System.Windows.Forms.Timer();

Expand Down Expand Up @@ -110,10 +110,13 @@ public void Init()
return;
}

Application.ApplicationExit += Application_ApplicationExit;

if (notifyIcon != null)
{
Application.ApplicationExit += Application_ApplicationExit;

volumePopup = new VolumePoup();

if (Settings.Default.HideOSD)
HideOSD();
else
Expand All @@ -134,14 +137,14 @@ public void Init()
};

notifyIconIdentifier.cbSize = (uint)Marshal.SizeOf(notifyIconIdentifier);
}

KeyHook.VolumeKeyPressed += KeyHook_VolumeKeyPressed;
KeyHook.VolumeKeyReleased += KeyHook_VolumeKeyReleased;
KeyHook.VolumeKeyPressed += KeyHook_VolumeKeyPressed;
KeyHook.VolumeKeyReleased += KeyHook_VolumeKeyReleased;

KeyHook.StartListening();
KeyHook.StartListening();

hideTimer.Tick += HideTimer_Tick;
hideTimer.Tick += HideTimer_Tick;
}
}

private IntPtr FindOSDWindow(bool bSilent)
Expand Down Expand Up @@ -257,6 +260,9 @@ public void HideOSD()

private void internalShowOSD(bool init = false)
{
if (notifyIcon == null)
return;

float volume = volumePopup.getVolume();

hideTimer.Stop();
Expand Down Expand Up @@ -307,6 +313,9 @@ public void ShowOSD()

public void ShowMessage(String message, ToolTipIcon icon)
{
if (notifyIcon == null)
return;

notifyIcon.ShowBalloonTip(5000, "HideVolumeOSD", message, icon);

long tickCountEnd = Environment.TickCount + 5000;
Expand Down