FORM SOBRE OBJETO

USUARIO.EXCLUIDOS 04/03/2005 20:18:19
#71199
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.
GABRIEL.LOGAN 04/03/2005 20:44:59
#71200
'MODULO

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.
USUARIO.EXCLUIDOS 04/03/2005 21:11:21
#71202
deu problema nesse codigo, aparece uma mensagen Overflow

Debug
res <--- = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
GABRIEL.LOGAN 04/03/2005 21:16:04
#71204
Qual o nome do seu form?

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)
FELIPEA 05/03/2005 09:41:14
#71219
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
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
GABRIEL.LOGAN 05/03/2005 10:32:15
#71226
FELIPEA esses codigos nossos so funcionam no WIN98, e WIN ME, no WIN XP não.
USUARIO.EXCLUIDOS 05/03/2005 13:24:08
#71240
Eesse codigo funfo blz no winxp.

vlw pela ajuda.
FELIPEA 06/03/2005 13:46:28
#71386
Encerre o tópico
Tópico encerrado , respostas não são mais permitidas