Alfie Jones
Alfie Jones

Reputation: 132

Extracting a process's icon from a UWP app

How do I get a process's associated Icon from a C# UWP application?

I am currently in the process of porting a WPF application to UWP and unfortunately found that system.drawing isn't apart of the UWP SDK.

In my WPF program, I used Bitmap Icon = System.Drawing.Icon.ExtractAssociatedIcon(process.MainModule.FileName).ToBitmap(); to extract the icon but this no longer works.

Any suggestions will be much appreciated.

Upvotes: 1

Views: 436

Answers (1)

Xie Steven
Xie Steven

Reputation: 8591

How do I get a process's associated Icon from a C# UWP application?

In UWP, you could use AppDiagnosticInfo Class relevant APIs to get the application's logo.

Locate to the specific method is the AppDisplayInfo.GetLogo(Size) Method.

You couuld see the complete steps in this blog UWP App Diagnostics.

Please note that if your app uses these APIs, you’ll need to declare the appDiagnostics capability in your manifest.

Upvotes: 1

Related Questions