MANTER FORMULARIO SOBRE OUTRAS JANELAS
Galera, eu tenho um cod aki que faz isso mas ele da um erro, e não lembro como que arrumava...
olhem ai e me fale qual é o problema...
eu sei que em [Ô][Ô]End SubLAGS[Ô][Ô] da erro mas é pq o cara que escreveu o cod esqueceu de um enter e tbm da erro em [Ô][Ô]AlwaysOnTop Me.Name, True[Ô][Ô] quem puder me ajudar...
vlw
Private 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
Private Const SWP_FLAGS = 3
Private Const SWP_HWND_TOPMOST = -1
Private Const SWP_HWND_NOTOPMOST = -2
Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)
Dim lFlag As Long
If SetOnTop Then
lFlag = SWP_HWND_TOPMOST
Else
lFlag = SWP_HWND_NOTOPMOST
End If
SetWindowPos myfrm.hwnd, lFlag, myfrm.Left / Screen.TwipsPerPixelX, myfrm.Top / Screen.TwipsPerPixelY, myfrm.Width / Screen.TwipsPerPixelX, myfrm.Height / Screen.TwipsPerPixelY, SWP_FLAGS
End SubLAGS
End Sub
Form1_load()
AlwaysOnTop Me.Name, True
End sub
olhem ai e me fale qual é o problema...
eu sei que em [Ô][Ô]End SubLAGS[Ô][Ô] da erro mas é pq o cara que escreveu o cod esqueceu de um enter e tbm da erro em [Ô][Ô]AlwaysOnTop Me.Name, True[Ô][Ô] quem puder me ajudar...
vlw
Private 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
Private Const SWP_FLAGS = 3
Private Const SWP_HWND_TOPMOST = -1
Private Const SWP_HWND_NOTOPMOST = -2
Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)
Dim lFlag As Long
If SetOnTop Then
lFlag = SWP_HWND_TOPMOST
Else
lFlag = SWP_HWND_NOTOPMOST
End If
SetWindowPos myfrm.hwnd, lFlag, myfrm.Left / Screen.TwipsPerPixelX, myfrm.Top / Screen.TwipsPerPixelY, myfrm.Width / Screen.TwipsPerPixelX, myfrm.Height / Screen.TwipsPerPixelY, SWP_FLAGS
End SubLAGS
End Sub
Form1_load()
AlwaysOnTop Me.Name, True
End sub
coloque isso em um módulo:
Segue um projeto exemplo:
Option Explicit
Private 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
Private Const SWP_FLAGS = 3
Private Const SWP_HWND_TOPMOST = -1
Private Const SWP_HWND_NOTOPMOST = -2
Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)
Dim lFlag As Long
If SetOnTop Then
lFlag = SWP_HWND_TOPMOST
Else
lFlag = SWP_HWND_NOTOPMOST
End If
SetWindowPos myfrm.hwnd, lFlag, myfrm.Left / Screen.TwipsPerPixelX, myfrm.Top / Screen.TwipsPerPixelY, myfrm.Width / Screen.TwipsPerPixelX, myfrm.Height / Screen.TwipsPerPixelY, SWP_FLAGS
End Sub
no load do frm que vai ficar sempre por cima, coloque assim:
Private Sub Form_Load()
AlwaysOnTop Me, True
End Sub
Segue um projeto exemplo:
Tópico encerrado , respostas não são mais permitidas