Mettre une application en premier plan? et autres questions

jnbrunet Messages postés 258 Date d'inscription samedi 25 décembre 2004 Statut Membre Dernière intervention 13 novembre 2012 - 29 mars 2005 à 19:45
Hedrock Messages postés 9 Date d'inscription lundi 7 juillet 2003 Statut Membre Dernière intervention 30 mars 2005 - 30 mars 2005 à 15:37
Quelles sont les apis pour mettre une application(j'ai son handle) en premier plan, pour fermer cette même application, et pour exécuter un raccoursi?

Jn

1 réponse

Hedrock Messages postés 9 Date d'inscription lundi 7 juillet 2003 Statut Membre Dernière intervention 30 mars 2005
30 mars 2005 à 15:37
Salut,

Pour mettre une feuille au premier plan:
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 DEVANT = -1&
Private Const NON_DEVANT = -2&
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40


Public Sub FormTop(ctrl As Form)
SetWindowPos ctrl.Hwnd, DEVANT, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub


Public Sub FormNoTop(ctrl As Form)
SetWindowPos ctrl.Hwnd, NON_DEVANT, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub

Ce code marche avec le handle d'un formulaire, essaye de voir si ça marche
dans ton cas.

Pour exécuter un raccourcis (ou tout autre document):
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Const SW_SHOWNORMAL = 1
Ret& = ShellExecute(0, vbNullString, "c:\...\MonDocument", "", vbNullString, SW_SHOWNORMAL)

Bon code,
H.
0
Rejoignez-nous