Hi.
Ich versuche gerade eine Form über alles zustellen das diese halt im Vordergrund ist selbst über der Taskleiste und da ist auch mein Problem. Ich bekomme es nicht hin das die Form die Taskleiste verdeckt.
Code
Mit Dem code kann ich die Form zwar im vordergrund halten aber nicht über der Taskleiste.
Ich versuche gerade eine Form über alles zustellen das diese halt im Vordergrund ist selbst über der Taskleiste und da ist auch mein Problem. Ich bekomme es nicht hin das die Form die Taskleiste verdeckt.
VB.NET-Quellcode
- Private Declare Function SetWindowPos Lib "user32" _
- Alias "SetWindowPos" ( _
- ByVal hwnd As Integer, _
- ByVal hWndInsertAfter As Integer, _
- ByVal x As Integer, _
- ByVal y As Integer, _
- ByVal cx As Integer, _
- ByVal cy As Integer, _
- ByVal wFlags As Integer) As Integer
- Private Const HWND_TOPMOST = -1
- Private Const HWND_NOTOPMOST = -2
- Private Const SWP_NOMOVE = &H2
- Private Const SWP_NOSIZE = &H1
- Private Sub FormOnTop(ByVal hWnd As Integer, ByVal OnTop As Boolean)
- If OnTop Then
- SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
- Else
- SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- FormOnTop(Me.Handle, True)
- End Sub
Mit Dem code kann ich die Form zwar im vordergrund halten aber nicht über der Taskleiste.