FORM SOBRE OBJETO
Ola!!1 gostaria de colocar meu form em cima de qualquer objeto é possivel isso??? ex: abri um explorer e fazer meu form sempre fica acima desse explorer.
vlw vocês me ajudam muito por aqui......
um abraço a todos desse forum.
vlw vocês me ajudam muito por aqui......
um abraço a todos desse forum.
'MODULO
FORM_LOAD
OBS:. Form1 você substitui pelo nome do seu FORM.
Declare Function SetWindowPos Lib "user32" (ByVal h%, ByVal hb%, _
ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal F%) As Integer
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const flags = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
'------DEIXA SUA JANELA NA FRENTE DE TUDO!FORM_LOAD
res = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)OBS:. Form1 você substitui pelo nome do seu FORM.
deu problema nesse codigo, aparece uma mensagen Overflow
Debug
res <--- = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
Debug
res <--- = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
Qual o nome do seu form?
No lugar de:
Coloque:
No lugar de:
res = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)Coloque:
res = SetWindowPos(SEU FORM.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
Não seria melhor colocar "ME" ao invez de "SEU FORM"? :P
Bem, esse código funcionou perfeitamente comigo:
Coloque esse código no form
Bem, esse código funcionou perfeitamente comigo:
Coloque esse código no form
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
Const MF_BYPOSITION = &H400&
Const SWP_FLAGS = 3
Const SWP_HWND_TOPMOST = -1
Const SWP_HWND_NOTOPMOST = -2
Private Sub SempreVisivel(Form As Object, SetAsTopMost As Boolean)
Dim Flag As Long
If SetAsTopMost Then
Flag = SWP_HWND_TOPMOST
Else
Flag = SWP_HWND_NOTOPMOST
End If
SetWindowPos Form.hWnd, Flag, Form.Left / Screen.TwipsPerPixelX, Form.Top / Screen.TwipsPerPixelY, Form.Width / Screen.TwipsPerPixelX, Form.Height / Screen.TwipsPerPixelY, SWP_FLAGS
End Sub
Private Sub Form_Load()
SempreVisivel Me, True
End Sub
FELIPEA esses codigos nossos so funcionam no WIN98, e WIN ME, no WIN XP não.
Eesse codigo funfo blz no winxp.
vlw pela ajuda.
vlw pela ajuda.
Encerre o tópico
Tópico encerrado , respostas não são mais permitidas