I am trying to get the toast window to act just like the tip of the cylinder tray. He should stay in front of every window and not steal focus. But when I press the desktop button on the desktop in the lower right corner of Windows 7 and show this window with toasts after 5 seconds, it does not appear on my screen. But when I select another window on the taskbar, it appears after that.
When I use the top toast, it always displays correctly, but then it steals focus from directx games, etc. and returns to the desktop, so I can’t use the top.
This is what I do:
NotificationForm form = new NotificationForm(5000, new Size(400, 300), img, url);
NativeMethods.ShowWindow(form.Handle, (int)WindowShowStyle.ShowNoActivate);
NativeMethods.SetWindowPos(form.Handle, (IntPtr)SpecialWindowHandles.HWND_TOP, 0, 0, 0, 0,
SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
Full source code here:
https://github.com/ShareX/ShareX/blob/master/ShareX/Forms/NotificationForm.cs
I think the Windows balloon tip uses the very top and still manages not to steal focus when playing full-screen DirectX games. Not sure how it works.
source
share