diff --git a/HideVolumeOSD/HideVolumeOSDLib.cs b/HideVolumeOSD/HideVolumeOSDLib.cs index a0e0fe6..e83fd2e 100644 --- a/HideVolumeOSD/HideVolumeOSDLib.cs +++ b/HideVolumeOSD/HideVolumeOSDLib.cs @@ -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(); @@ -110,10 +110,12 @@ public void Init() return; } - Application.ApplicationExit += Application_ApplicationExit; - if (notifyIcon != null) { + volumePopup = new VolumePoup(); + + Application.ApplicationExit += Application_ApplicationExit; + if (Settings.Default.HideOSD) HideOSD(); else @@ -134,14 +136,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) @@ -297,12 +299,15 @@ public void ShowOSD() ShowWindow(hWndInject, 9); // SW_RESTORE - // show window on the screen - internalShowOSD(); - if (notifyIcon != null) + { + // show window on the screen + + internalShowOSD(); + notifyIcon.Icon = Resources.Icon; + } } public void ShowMessage(String message, ToolTipIcon icon)