I need to open notification form without giving it a focus when it appears. It works fine using P/Invoke except the fact that Shown event is not getting launched. My solution is here, but is there more elegant (more generic) one?
Public Shared Sub ShowInactiveTopmost(frm As Form)
'standard P/Invoke code
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE)
SetWindowPos(frm.Handle.ToInt32(), HWND_TOPMOST,
frm.Left, frm.Top, frm.Width, frm.Height, SWP_NOACTIVATE)
'invocation of 'Shown' event - can this be made independent of 'NotifForm' type?
CType(frm, NotifForm).NotifForm_Shown(Nothing, New EventArgs())
End Sub
I tried more generic approach using RaiseEvent Shown()
but it was throwing error Derived classes cannot raise base class events.