OVH Cloud OVH Cloud

Applications (mais non processus) en mémoire

1 réponse
Avatar
Yves Haenni
Bonjour,

Hier, j'ai posé une question dans ce forum à savoir comment faire afficher
toutes les applications ouvertes en mémoire. J'ai reçu une réponse avec
trois solutions, et je tiens à remercier Frederic Sigonneau pour ces
solutions qui fonctionnent très bien. Le seul hic, c'est que j'aimerais
avoir les applications ouvertes en mémoire et non les processus. Voir à ce
sujet la différence qu'il y a entre "Applications" et "Processus" lorsqu'on
lance le Gestionnaire des tâches sous Windows.

Merci d'avance pour toute aide.

Yves

1 réponse

Avatar
Michel Pierron
Bonjour Yves;
Limite la recherche aux fenêtres visibles et dont le titre est différent de
"Program manager" qui doit tourner en permanence:
Private Declare Function GetWindowTextLength Lib "user32.dll" _
Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32.dll" Alias _
"GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String _
, ByVal nMaxCount As Long) As Long
Private Declare Function EnumWindows Lib "user32.dll" _
(ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" _
(ByVal hwnd As Long) As Long
Private x&

Private Function EnumWindowsProc&(ByVal hwnd&, ByVal lParam&)
Dim SLength&, Buffer As String, RetVal&
SLength = GetWindowTextLength(hwnd) + 1
If SLength > 1 Then
Buffer = Space(SLength)
GetWindowText hwnd, Buffer, SLength
If IsWindowVisible(hwnd) Then
If Not Left(Buffer, SLength - 1) = "Program Manager" Then
x = x + 1: Cells(x, 1) = Left(Buffer, SLength - 1)
End If
End If
End If
EnumWindowsProc = 1
End Function

Sub ApplicationsList()
Application.ScreenUpdating = False
Cells.ClearContents
Cells(1, 1) = "CAPTION"
Cells(1, 1).Font.Bold = True
Cells(2, 1).Select
ActiveWindow.FreezePanes = True
x = 1
EnumWindows AddressOf EnumWindowsProc, 0
Cells.Columns.AutoFit
End Sub

MP

"Yves Haenni" a écrit dans le message de
news:416e341a$
Bonjour,

Hier, j'ai posé une question dans ce forum à savoir comment faire afficher
toutes les applications ouvertes en mémoire. J'ai reçu une réponse avec
trois solutions, et je tiens à remercier Frederic Sigonneau pour ces
solutions qui fonctionnent très bien. Le seul hic, c'est que j'aimerais
avoir les applications ouvertes en mémoire et non les processus. Voir à
ce

sujet la différence qu'il y a entre "Applications" et "Processus"
lorsqu'on

lance le Gestionnaire des tâches sous Windows.

Merci d'avance pour toute aide.

Yves