我想获取它在 Windows 上运行的当前应用程序的名称。
例如,如果我使用 ie,此功能将提供“Internet Explorer”,或者如果我使用 Google chrome,则提供 Chrome ...
System.AppDomain.CurrentDomain.FriendlyName
或者可能
System.Reflection.Assembly.GetExecutingAssembly()
或者如果您的意思是您想要活动窗口的名称,那么您应该查看;
试试这个,如果你用过 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;
        }
    }