3

我想知道是否可以在 C# Metro 应用程序中获取正在运行的 MetroStyle 应用程序的列表。我希望在 Windows 8(不是 Windows Phone)中执行此操作。

4

2 回答 2

4

我正在用 Delphi 编写一个 Alt-Tab 手势替代方案,所以这是我发现列出正在运行的 ModernUI(曾经是 Metro)应用程序的方式,我只用 Windows 8 Release Preview 对其进行了测试,我不知道它是否仍然有效在 Windows 8 RTM 上。

procedure ShowRunningModernUIApps;
var
  metroapp:hwnd;
  strAppTitle: array[0..MAX_PATH]of char;
  h:integer;
  strListApps:string;
begin
  metroapp:=FindWindow('Windows.UI.Core.CoreWindow',nil);
  if metroapp <>0 then
  begin
    GetWindowText(metroapp,strAppTitle,MAX_PATH);
    strListApps:='Running ModernUI Apps : '+strAppTitle;
    h:=0;
    while h=0 do
    begin
      metroapp:=FindWindowEx(0,metroapp,'Windows.UI.Core.CoreWindow',nil);
      if metroapp<>0 then
      begin
        GetWindowText(metroapp,strAppTitle,MAX_PATH);
        strListApps:=strListApps+','+strAppTitle;
      end
      else h:=1; //let's finish the search loop

    end;
  end;
  ShowMessage(strListApps);

end;

这显示了当前正在运行的 ModernUI 应用程序的标题,您可以随意存储它们的 HWND。

于 2012-08-18T22:12:50.240 回答
3

不可能。那将是对沙盒的破坏。您不希望某些随机应用程序获取有关您运行的应用程序的信息并将其报告回家。

于 2012-06-26T07:01:09.030 回答