5

I want to get the name of current application that it's running on windows.

For example, if i work with i.e, this function give "Internet explorer" or if i work with Google chrome, give Chrome...

a d
  • 552
  • 2
  • 7
  • 17

3 Answers3

9
System.AppDomain.CurrentDomain.FriendlyName

or maybe

System.Reflection.Assembly.GetExecutingAssembly()

or if you mean that you want the name of the active window then you should look at;

How do I get the title of the current active window using c#?

Community
  • 1
  • 1
madbrendon
  • 640
  • 1
  • 7
  • 19
  • 1
    Do you mean you want the name of the currently active window? If so see http://stackoverflow.com/questions/115868/how-do-i-get-the-title-of-the-current-active-window-using-c – madbrendon Apr 17 '13 at 02:24
1

You can use Assembly.FullName

System.Reflection.Assembly.GetEntryAssembly().FullName;

Please also take a look at this question:

How do I get the name of the current executable in C#?

Community
  • 1
  • 1
Alina B.
  • 1,256
  • 8
  • 18
0

Try this, If you have used GetWindowThreadProcessId.

public String GetActiveFileNameTitle()
    {
        IntPtr hWnd = GetForegroundWindow();
        uint procId = 0;
        GetWindowThreadProcessId(hWnd, out procId);
        var proc = Process.GetProcessById((int)procId);
        if (proc != null)
        {
           return proc.MainModule.FileVersionInfo.ProductName;
        }

    }
Dinesh
  • 507
  • 4
  • 14
  • 23