Link to home
Start Free TrialLog in
Avatar of Hanky368
Hanky368

asked on

Active Programs

how can i retrieve a list of Active Programs? This includes programs that are invisable and such
Avatar of Maquiavelo
Maquiavelo

 I think this answer deserves more points...
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hanky368

ASKER

code would be nice thanks
Hello Hanky!!

Here is some code that works just fine...

Simply place a command button, and a listbox on your form without changing any of the controls' names... then add a module and place the following code in there...

============MODULE1.BAS===========
Const MAX_PATH = 260

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lparam As Long) As Long

Function GetWins(ByVal handle As Long, ByVal lparam As Long) As Long
    Dim title As String
    GetWins = 1
    title = Space$(MAX_PATH)
    GetWindowText handle, title, MAX_PATH
    Form1.List1.AddItem title
End Function

'When you're done with that simply place the following code in button's OnClick()

=========FORM1.FRM==========

Private Sub Command1_Click()
    List1.Clear
    EnumWindows AddressOf GetWins, 0
End Sub


That's about it...

Please let me know if you need any more help!!

..-=ViKtOr=-..