3
I need to get the app icon that is open on the screen. App icons, browsers (examples pick up the Chrome icon , word icon and so on...)
I tried to do so:
Process[] listProcesses = Process.GetProcesses();
foreach (Process p in listProcesses)
{
Icon icon = Icon.ExtractAssociatedIcon(mo.MainModule.FileName);
string uri = @"C:\imagens\" + p.ProcessName + ".ico";
if (!File.Exists(uri))
{
FileStream stream = new FileStream(uri, FileMode.CreateNew);
icon.Save(stream);
}
However I am having the following error(Only a part of a Readprocessmemory or Writeprocessmemory request has been completed).
Does anyone have any idea??
What application is this? Explain your problem better.
– Jéf Bueno
I ran this code here and the errors I got were denied access. I didn’t get the error you described. By ignoring errors (Try-catch, with empty catch), I was able to get all possible icons from my applications.
– Oralista de Sistemas
Face mine is not rolling and continues with the mistake I described above.
– lucas
Is terminating your Filestream after using?
– brazilianldsjaguar
Open the file of manifesto, if you don’t have a, and insert the <requestedExecutionLevel level="requireAdministrator" /> line inside the node
trustInfo/security/requestedPrivileges
– Augusto Vasques