Garder le focus d'une feuille même si on lance une autre appli

mathieuleydier Messages postés 53 Date d'inscription jeudi 15 avril 2004 Statut Membre Dernière intervention 30 avril 2008 - 9 juin 2004 à 17:37
mathieuleydier Messages postés 53 Date d'inscription jeudi 15 avril 2004 Statut Membre Dernière intervention 30 avril 2008 - 10 juin 2004 à 08:36
bonjour, en fait j'ai un petit souci : je fais un petit programme qui pilote une application windows qui n'est aps de moi, et j'aimerai en fait que même si on clique sur l'autre appli ma form reste au premier plan de ouindoz par dessus l'appli
hassan cehef ci poussibl???

2 réponses

Neo.balastik Messages postés 796 Date d'inscription jeudi 17 mai 2001 Statut Membre Dernière intervention 5 mai 2009 7
9 juin 2004 à 18:37
Salut ;O)

Utilise ceci :

'A COPIER DANS UN MODULE:
'--------------------------------

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

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_DRAWFRAME = &H20
Public Const SWP_SHOWWINDOW = &H40

Public Sub FormOnTop(hWindow As Long, bTopMost As Boolean)

Dim wFlags, Placement

wFlags = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOACTIVATE

Select Case bTopMost
Case True
Placement = HWND_TOPMOST
Case False
Placement = HWND_NOTOPMOST
End Select

SetWindowPos hWindow, Placement, 0, 0, 0, 0, wFlags

End Sub

'UTILISATION :

Call FormOnTop(TaForm.Hwnd,True)

Guy
0
mathieuleydier Messages postés 53 Date d'inscription jeudi 15 avril 2004 Statut Membre Dernière intervention 30 avril 2008
10 juin 2004 à 08:36
coooool merci ca marche tip top moumoute
a+
0
Rejoignez-nous