Results 1 to 5 of 5

Thread: [RESOLVED] Application List

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Resolved [RESOLVED] Application List

    Hi, is there a way to go about getting the current running application list into a drop-down and/or text box menu.

    What I want to do is make it so you can pick a running application and set it as a label value.

    Thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Application List

    Welcome to the forums.

    Try this
    vb Code:
    1. 'in a module
    2. Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
    3.  
    4. Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, _
    5. ByVal lParam As Long) As Long
    6.  
    7. Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
    8. ByVal lpString As String, ByVal cch As Long) As Long
    9.  
    10. Public Const MAX_LEN = 260
    11.  
    12. Public Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
    13.     Dim lRet As Long
    14.     Dim strBuffer As String
    15.    
    16.     If IsWindowVisible(hwnd) Then
    17.         strBuffer = Space(MAX_LEN)
    18.         lRet = GetWindowText(hwnd, strBuffer, Len(strBuffer))
    19.         If lRet Then
    20.             Form1.List1.AddItem Left(strBuffer & "  " & hwnd, lRet)
    21.         End If
    22.     End If
    23.    
    24.     EnumWinProc = 1
    25. End Function
    26.  
    27. 'on a form
    28. Private Sub Command1_Click()
    29. Call EnumWindows(AddressOf EnumWinProc, 0)
    30. End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Re: Application List

    Thanks so much, Big help

    One more question how would I make it so when you click on an application in the list it sets the value of app.text to the application name?

    Thanks again.

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Application List

    Which app.name do you want ot change, the one from your application or the one from the application clicked in the list?

    first one would be easy:
    Code:
    app.name = Form1.List1.List(Form1.List1.ListIndex)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Re: [RESOLVED] Application List

    I used
    Code:
    app.Text = Form1.List1.List(Form1.List1.ListIndex)
    to set a text box value as an item I selected from the list.

    Thanks for all the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width