Hey guys. I have a form, no title bar, no control box, no border.
Now what happens is that I've registered a system wide hotkey. A combination of "shift + U".
Everything works. When the form has focus, the hotkey fires an event where i display a message box. But when I am on other window (lets say IE, or on the desktop), the hotkey STILL fires the event..
BUT I need to know how to bring my form on top.
This code works perfect but has a flaw (keep reading)
vb.net Code:
Public Delegate Sub moveTopMostInvoker() Private Sub SystemWideHotkeyComponent1_HotkeyPressed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SystemWideHotkeyComponent1.HotkeyPressed If Me.InvokeRequired Then Me.Invoke(New moveTopMostInvoker(AddressOf moveTopMost)) Else moveTopMost() End If MsgBox("haza") End Sub Public Sub moveTopMost() Me.TopMost = True Me.Focus() End Sub
However, when the form goes on top obviously the topmost property is true and therefore it dosnt go back in the background.
How can I make it so it comes up. Remember a event fires if my application is running regardless of whether it has focus or not.


Reply With Quote