【发布时间】:2013-04-09 15:16:46
【问题描述】:
我想获取它在 Windows 上运行的当前应用程序的名称。
例如,如果我使用,即此功能提供“Internet Explorer”,或者如果我使用 Google chrome,则提供 Chrome...
【问题讨论】:
我想获取它在 Windows 上运行的当前应用程序的名称。
例如,如果我使用,即此功能提供“Internet Explorer”,或者如果我使用 Google chrome,则提供 Chrome...
【问题讨论】:
System.AppDomain.CurrentDomain.FriendlyName
或许
System.Reflection.Assembly.GetExecutingAssembly()
或者如果您的意思是想要活动窗口的名称,那么您应该查看;
How do I get the title of the current active window using c#?
【讨论】:
【讨论】:
试试这个,如果你用过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;
}
}
【讨论】: