Always on top

cs_AbriBus Messages postés 492 Date d'inscription jeudi 28 août 2003 Statut Membre Dernière intervention 25 avril 2007 - 3 sept. 2003 à 10:42
cs_AbriBus Messages postés 492 Date d'inscription jeudi 28 août 2003 Statut Membre Dernière intervention 25 avril 2007 - 3 sept. 2003 à 11:09
Bonjour à tous...
Quelqu'un sait-il comment puorrais-je faire pour qu'un Form soit toujours visible sous windows ? J'ai jetté un oeil un petit peu partout sur le site et je n'ai pas trouver. Je m'excuse donc par avance si cette question était redondante ou si une sources était déjà disponible ici mais puisque je ne l'aurais pas vue, merci de bien vouloir m'en donner la référence (le cien carrement serait super cool)
Merci d'avance... :shy)

2 réponses

crenaud76 Messages postés 4172 Date d'inscription mercredi 30 juillet 2003 Statut Membre Dernière intervention 9 juin 2006 28
3 sept. 2003 à 11:04
Mets ce petit bout de code dans un module standard :
Option Explicit

Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
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 Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long
    If Topmost = True Then
        SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
    Else
        SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
        SetTopMostWindow = False
    End If
End Function


Et met ce code dans le Form_Load
Private Sub Form_Load()
    SetTopMostWindow Me.hwnd, True
End Sub

Christophe R.
0
cs_AbriBus Messages postés 492 Date d'inscription jeudi 28 août 2003 Statut Membre Dernière intervention 25 avril 2007 5
3 sept. 2003 à 11:09
Alors ca c'est NIKEL ! Merci bcps Christophe c'est PARFAIT !
0
Rejoignez-nous