|
-
Nov 28th, 2005, 04:00 PM
#1
Thread Starter
New Member
Knowing what applications are running
Is there a way for your program to know what other applications are running and what application has the focus at a given time? Perhaps getting the current form name of the application that has the focus.
-
Nov 29th, 2005, 07:56 AM
#2
Re: Knowing what applications are running
Welcome to the forums. 
Are you talking about a Task Manager type application that can list all open applications?
-
Nov 29th, 2005, 03:42 PM
#3
Thread Starter
New Member
Re: Knowing what applications are running
Not really a task manager. I want my program to be able to tell what program has focus. What the program name is. Im guessing it can get that from a API? Once it does to store it in a variable and desplay it in a text box or something. I dont want it to be able to see any other programs at the time. Just the one that is currently being used.
-
Dec 1st, 2005, 06:45 AM
#4
Re: Knowing what applications are running
GetForegroundWindow()
Sample usage:
VB Code:
Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextW" ( _
ByVal hWnd As Long, _
ByVal lpString As Long, _
ByVal nMaxCount As Long _
) As Long
Function GetActiveWindowName() As String
GetActiveWindowName = String$(255)
GetWindowText GetForegroundWindow(), StrPtr(GetActiveWindowName), 255
GetActiveWindowName = Trim$(GetActiveWindowName)
End Function
Last edited by penagate; Dec 1st, 2005 at 06:50 AM.
-
Dec 1st, 2005, 05:02 PM
#5
Thread Starter
New Member
Re: Knowing what applications are running
How would I display the information in a label or list?
-
Dec 1st, 2005, 06:15 PM
#6
Re: Knowing what applications are running
That's the trivial part...
VB Code:
Label1.Caption = GetActiveWindowName()
-
Dec 3rd, 2005, 12:57 AM
#7
Thread Starter
New Member
Re: Knowing what applications are running
Can you send me a zip of this working? I just want to see if it all really does work. It didnt for me.
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
|