Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
le_troll
Bonjour,
Oui, on peut le savoir, voici:
' Form1 '**************************************** ' OBJETS = List1 (Sorted = True) + Text1 = 2 objets ' *************************************** ' form1 tous les handles ' Private Declare Function GetForegroundWindow Lib "user32" () As Long 'hwnd (handle de la forme) ' Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long ' Private Declare Function EnumWindows Lib "user32" _ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long ' Sub Form_Load() ' LIST1 + TEXT1 Dim hwnd ' List1.Clear GetWindowsList ' ' handle de cette form hwnd = GetForegroundWindow Text1 = "Handle en cours : " & hwnd End Sub
Private Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long Dim stTmp As String, lgTmp As Long, lgRet As Long ' stTmp = Space$(120) lgTmp = 119 lgRet = GetWindowText(lgHwnd, stTmp, lgTmp) If Len(stTmp) > 1 And lgRet <> 0 Then Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp End If EnumWindowsProc = 1 End Function
'******************** ' Module1 '******************** Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long ' Public Declare Function EnumWindows Lib "user32" _ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long '
Public Function GetWindowsList() Dim lgRep As Long ' stGetWindowsList = vbNullString lgRep = EnumWindows(AddressOf EnumWindowsProc, 0) End Function
Public Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long Dim stTmp As String, lgTmp As Long, lgRet As Long ' stTmp = Space$(120) lgTmp = 119 lgRet = GetWindowText(lgHwnd, stTmp, lgTmp) If Len(stTmp) > 1 And lgRet <> 0 Then Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp End If EnumWindowsProc = 1 End Function
-- Merci, @+, bye, Joe troll75 AROBASE iFrance POINT com ------------------------------------------ Le_Troll, éleveur de Trolls depuis César, qui disait: Avec une hache, celui qui tient le manche a toujours raison !
"yann" a écrit dans le message de news:72de01c494c3$1aae4a60$
Bonjour, Est-il possible de savoir si un exe est en cours de marche?
Merci
Bonjour,
Oui, on peut le savoir, voici:
' Form1
'****************************************
' OBJETS = List1 (Sorted = True) + Text1 = 2 objets
' ***************************************
' form1 tous les handles
'
Private Declare Function GetForegroundWindow Lib "user32" () As Long
'hwnd (handle de la forme)
'
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
_
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As
Long
'
Private Declare Function EnumWindows Lib "user32" _
(ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
'
Sub Form_Load() ' LIST1 + TEXT1
Dim hwnd
'
List1.Clear
GetWindowsList
'
' handle de cette form
hwnd = GetForegroundWindow
Text1 = "Handle en cours : " & hwnd
End Sub
Private Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As
Long) As Long
Dim stTmp As String, lgTmp As Long, lgRet As Long
'
stTmp = Space$(120)
lgTmp = 119
lgRet = GetWindowText(lgHwnd, stTmp, lgTmp)
If Len(stTmp) > 1 And lgRet <> 0 Then
Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp
End If
EnumWindowsProc = 1
End Function
'********************
' Module1
'********************
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
_
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As
Long
'
Public Declare Function EnumWindows Lib "user32" _
(ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
'
Public Function GetWindowsList()
Dim lgRep As Long
'
stGetWindowsList = vbNullString
lgRep = EnumWindows(AddressOf EnumWindowsProc, 0)
End Function
Public Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long)
As Long
Dim stTmp As String, lgTmp As Long, lgRet As Long
'
stTmp = Space$(120)
lgTmp = 119
lgRet = GetWindowText(lgHwnd, stTmp, lgTmp)
If Len(stTmp) > 1 And lgRet <> 0 Then
Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp
End If
EnumWindowsProc = 1
End Function
--
Merci, @+, bye, Joe
troll75 AROBASE iFrance POINT com
------------------------------------------
Le_Troll, éleveur de Trolls depuis César, qui disait:
Avec une hache, celui qui tient le manche a toujours raison !
"yann" <anonymous@discussions.microsoft.com> a écrit dans le message de
news:72de01c494c3$1aae4a60$a601280a@phx.gbl...
Bonjour,
Est-il possible de savoir si un exe est en cours de
marche?
' Form1 '**************************************** ' OBJETS = List1 (Sorted = True) + Text1 = 2 objets ' *************************************** ' form1 tous les handles ' Private Declare Function GetForegroundWindow Lib "user32" () As Long 'hwnd (handle de la forme) ' Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long ' Private Declare Function EnumWindows Lib "user32" _ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long ' Sub Form_Load() ' LIST1 + TEXT1 Dim hwnd ' List1.Clear GetWindowsList ' ' handle de cette form hwnd = GetForegroundWindow Text1 = "Handle en cours : " & hwnd End Sub
Private Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long Dim stTmp As String, lgTmp As Long, lgRet As Long ' stTmp = Space$(120) lgTmp = 119 lgRet = GetWindowText(lgHwnd, stTmp, lgTmp) If Len(stTmp) > 1 And lgRet <> 0 Then Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp End If EnumWindowsProc = 1 End Function
'******************** ' Module1 '******************** Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long ' Public Declare Function EnumWindows Lib "user32" _ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long '
Public Function GetWindowsList() Dim lgRep As Long ' stGetWindowsList = vbNullString lgRep = EnumWindows(AddressOf EnumWindowsProc, 0) End Function
Public Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long Dim stTmp As String, lgTmp As Long, lgRet As Long ' stTmp = Space$(120) lgTmp = 119 lgRet = GetWindowText(lgHwnd, stTmp, lgTmp) If Len(stTmp) > 1 And lgRet <> 0 Then Form1.List1.AddItem Format(lgHwnd, "00000000") & " : " & stTmp End If EnumWindowsProc = 1 End Function
-- Merci, @+, bye, Joe troll75 AROBASE iFrance POINT com ------------------------------------------ Le_Troll, éleveur de Trolls depuis César, qui disait: Avec une hache, celui qui tient le manche a toujours raison !
"yann" a écrit dans le message de news:72de01c494c3$1aae4a60$
Bonjour, Est-il possible de savoir si un exe est en cours de marche?