Click here to Skip to main content
15,922,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hiii
in my application i want to capture the name of each currently running application from the titlebar,as i open new application then i want to get the name of new currently running application shown in titlebar.
Posted

1 solution

You should remember that using the text is the title bar can not be reliably used for application identification.

You should list all the processes running on the system, using the static method System.Diagnostics.Process.GetProcesses. Each process returned by this method is represented by the instance of the class System.Diagnostics.Process. You can use the property System.Diagnostics.Process.MainWindowTitle — this is what are you asking about. Make sure you put the call to this property under try-catch block as this call will throw exception when this value cannot be defined (closed processes, processes not using main window, etc.).

Please see other properties of the Process class and also the properties of System.Diagnostics.Process.MainModule. This property represent main module of the entry assembly, what people refer to as "executable file" (which not a strict notion in .NET, it is what I mentioned above).

—SA
 
Share this answer
 
Comments
Albin Abel 15-Mar-11 0:25am    
Correct one. My 5
Sergey Alexandrovich Kryukov 15-Mar-11 0:31am    
Thank you, Albin.
--SA
Espen Harlinn 15-Mar-11 12:10pm    
Good reply - 5!
Sergey Alexandrovich Kryukov 15-Mar-11 13:08pm    
Should work.
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900