Skip to content

Commit 7b4b855

Browse files
committed
Issue #38
1 parent 61b5636 commit 7b4b855

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

SmartSystemMenu/Forms/MainForm.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ private void HotKeyMouseHooked(object sender, HotKeys.MouseEventArgs e)
189189
protected override void OnClosed(EventArgs e)
190190
{
191191
_getMsgHook?.Stop();
192+
NativeMethods.SendNotifyMessage((IntPtr)NativeConstants.HWND_BROADCAST, NativeConstants.WM_NULL, 0, 0);
192193
_shellHook?.Stop();
194+
NativeMethods.SendNotifyMessage((IntPtr)NativeConstants.HWND_BROADCAST, NativeConstants.WM_NULL, 0, 0);
193195
_cbtHook?.Stop();
196+
NativeMethods.SendNotifyMessage((IntPtr)NativeConstants.HWND_BROADCAST, NativeConstants.WM_NULL, 0, 0);
194197

195198
if (_windows != null)
196199
{
@@ -228,6 +231,7 @@ protected override void OnClosed(EventArgs e)
228231
}
229232
#endif
230233
base.OnClosed(e);
234+
NativeMethods.SendNotifyMessage((IntPtr)NativeConstants.HWND_BROADCAST, NativeConstants.WM_NULL, 0, 0);
231235
}
232236

233237
protected override void WndProc(ref Message m)

SmartSystemMenu/Native/NativeMethods.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ static class NativeMethods
152152
[DllImport("user32.dll")]
153153
public static extern IntPtr PostMessage(IntPtr hWnd, int msg, UInt64 wParam, UInt64 lParam);
154154

155+
[DllImport("user32.dll")]
156+
public extern static int SendNotifyMessage(IntPtr hWnd, int msg, uint wParam, uint lParam);
157+
155158
[DllImport("user32.dll")]
156159
public static extern int SendMessageTimeout(IntPtr handle, int uMsg, uint wParam, uint lParam, SendMessageTimeoutFlags fuFlags, int uTimeout, out uint lpdwResult);
157160

SmartSystemMenu/SmartSystemMenu.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<processName>sihost.exe</processName>
88
<processName>chrome.exe</processName>
99
<processName>code.exe</processName>
10+
<processName>smartscreen.exe</processName>
1011
</processExclusions>
1112
<menuItems>
1213
<items>

0 commit comments

Comments
 (0)