TopMost is limited to the application windows and even at that may be limited to non-modal windows. I'm not sure why it isn't popping up in front of it's own though. I would recommend using the SetWindowPos API to set the form as TopMost for All windows regardless of application. You'll need to test for the focus issue but I believe you can show the form without focus even using the API.
VB Code:
Imports Microsoft.Win32 Public Class APIFunctions 'This class contains some of the API functions that i haven't found a way around in .NET yet. 'Primarily related to playinf sounds. Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Int32, ByVal hWndInsertAfter As Int32, ByVal x As Int32, ByVal y As Int32, ByVal cx As Int32, ByVal cy As Int32, ByVal wFlags As Int32) As Int32 Private Const HWND_TOPMOST As Integer = -1 Private Const HWND_NOTOPMOST As Integer = -2 Private Const SWP_NOMOVE As Integer = &H2 Private Const SWP_NOSIZE As Integer = &H1 Private Const TOPMOST_FLAGS As Integer = SWP_NOMOVE Or SWP_NOSIZE Public Shared Sub SetTopMost(ByVal frm As Form, ByVal topmost As Boolean) If topmost Then SetWindowPos(frm.Handle.ToInt32, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS) Else SetWindowPos(frm.Handle.ToInt32, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS) End If End Sub End Class 'syntax APIFunctions.SetTopMost(Me, True)




Reply With Quote