Reputation: 15233
I was wondering whether it's possible to get the list of running MetroStyle apps in a C# Metro app or not. I'm looking to do this in Windows 8 (not Windows Phone).
Upvotes: 3
Views: 1813
Reputation: 839
I'm writing an Alt-Tab gesture alternative with Delphi, so this is the way I found to list running ModernUI (once known Metro) applications, I tested it with Windows 8 Release Preview only, I don't know if it still works on 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;
This shows the current running ModernUI application's titles, you can store their HWND however you like.
Upvotes: 4
Reputation: 4115
Not possible. That would be a breach of sandbox. You don't want some random app getting information about the apps you run and reporting it home.
Upvotes: 3