MANTER FORM ATIVO
Boa tarde pessoal, duvidas de principiante!
Pessoal, tou fazendo um projeto e gostaria de manter o form aberto ativo, mesmo que clique em outro form ou outro programa. como fazer isso?
Pessoal, tou fazendo um projeto e gostaria de manter o form aberto ativo, mesmo que clique em outro form ou outro programa. como fazer isso?
Boa tarde, o que voce quer é um Formulario MDI segue links
http://www.macoratti.net/vb_forms.htm
http://www.macoratti.net/dica61.htm
http://msdn.microsoft.com/pt-br/library/zkysca23(v=vs.90).aspx
http://www.mxmasters.com.br/video-aulas/visual-basic/visual-basic-aula-4-usando-mdi-form-e-criando-menus/
Abraços
http://www.macoratti.net/vb_forms.htm
http://www.macoratti.net/dica61.htm
http://msdn.microsoft.com/pt-br/library/zkysca23(v=vs.90).aspx
http://www.mxmasters.com.br/video-aulas/visual-basic/visual-basic-aula-4-usando-mdi-form-e-criando-menus/
Abraços
nao é form MDI, este eu trabalho tranquilo, o que eu queria já achei aqui mesmo, em dicas, mas obrigado.
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
so colocar no Form load
AlwaysOnTop, me, true
e no form Unload
AlwaysOnTop, me, false
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
so colocar no Form load
AlwaysOnTop, me, true
e no form Unload
AlwaysOnTop, me, false
Sempre ativo eu desconheço, mas você pode deixar sempre visivel
Const hWnd_TOPMOST = -1
Const hWnd_NOTOPMOST = -2
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Sub Form_Load( )
Dim lngSuCCeSS As Long
lngSuCCeSS = SetWindowPos(Me.hWnd, hWnd_TOPMOST, 0, 0, 0, 0, FLAGS)
End sub
Abraço
Const hWnd_TOPMOST = -1
Const hWnd_NOTOPMOST = -2
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Sub Form_Load( )
Dim lngSuCCeSS As Long
lngSuCCeSS = SetWindowPos(Me.hWnd, hWnd_TOPMOST, 0, 0, 0, 0, FLAGS)
End sub
Abraço
Tópico encerrado , respostas não são mais permitidas