Active Programs

Posted on 1999-06-24
Medium Priority
Last Modified: 2010-05-02
how can i retrieve a list of Active Programs? This includes programs that are invisable and such
Question by:Hanky368
  • 2

Expert Comment

ID: 1519617
 I think this answer deserves more points...
LVL 10

Accepted Solution

viktornet earned 400 total points
ID: 1519618
you should use EnumWindows() which is a Win32 API and it needs a callback function which you need to write yourself.... in that callback function you simply get the name of the program, and put the name you get in a listbox or something... if you need some code or something please let me know so i can give you an example how to do it :)


Author Comment

ID: 1519619
code would be nice thanks
LVL 10

Expert Comment

ID: 1519620
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...

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()


Private Sub Command1_Click()
    EnumWindows AddressOf GetWins, 0
End Sub

That's about it...

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


Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question