windows-8 - 获取正在运行的 MetroStyle 应用程序列表

标签 windows-8 microsoft-metro

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

最佳答案

我正在使用 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。

关于windows-8 - 获取正在运行的 MetroStyle 应用程序列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11194759/

相关文章:

c# - 从 C# 显示关闭对话框

c# - 带换行的 TextBlock 的动态字体大小

c# - MVVM - ListView ItemClick 如何使用 Bindig 执行 RelayCommand

xaml - Metro 风格 XAML ScrollViewer 中的统一文本缩放

xamltypeinfo.g.cpp 中的 C++ 编译器错误

c++ - 用visual studio express 2012解决语法错误 "unexpected identifier dmap"

c# - 如何从 C# 中的 WebRequest 获取 XML?

c# - WebAuthenticationBroker.AuthenticateAsync 不工作

c++ - 在 Windows 8 上使用 Windows UI 自动化列出 Metro 应用程序的所有 UI 元素

c# - ApplicationDataCompositeValue 的大小