|
-
May 10th, 2007, 05:27 AM
#1
Thread Starter
Junior Member
[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
-
May 10th, 2007, 05:54 AM
#2
Re: Application List
Welcome to the forums. 
Try this
vb Code:
'in a module
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) As Long
Public Const MAX_LEN = 260
Public Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim lRet As Long
Dim strBuffer As String
If IsWindowVisible(hwnd) Then
strBuffer = Space(MAX_LEN)
lRet = GetWindowText(hwnd, strBuffer, Len(strBuffer))
If lRet Then
Form1.List1.AddItem Left(strBuffer & " " & hwnd, lRet)
End If
End If
EnumWinProc = 1
End Function
'on a form
Private Sub Command1_Click()
Call EnumWindows(AddressOf EnumWinProc, 0)
End Sub
-
May 10th, 2007, 06:22 AM
#3
Thread Starter
Junior Member
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.
-
May 10th, 2007, 06:42 AM
#4
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!
-
May 10th, 2007, 06:59 AM
#5
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|