Testa detta Jag var tvungen att byta handle till long istället för integer men då funkade det utmärktSv: Form fråga
'Lägg I en modul:
Option Explicit
Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal Y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_NOACTIVATE = &H10
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Sub FormOnTop(Handle As Integer, OnTop As Boolean)
Dim wFlags As Long, PosFlag As Long
wFlags = SWP_NOMOVE Or SWP_NOSIZE Or _
SWP_SHOWWINDOW Or SWP_NOACTIVATE
Select Case OnTop
Case True
PosFlag = HWND_TOPMOST
Case False
PosFlag = HWND_NOTOPMOST
End Select
SetWindowPos Handle, PosFlag, 0, 0, 0, 0, wFlags
End Sub
'I formen
Private Sub Command1_Click()
'******On top*******
FormOnTop Me.hwnd, True
End Sub
Private Sub Command2_Click()
'******Ej On top******
FormOnTop Me.hwnd, False
End Sub
/WolfSv: Form fråga