I need to get the applications icon that is open on the screen. Applications icons, browsers (examples take the chrome icon, word icon and so on ...)
I tried to do this:
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);
}
But I'm having the following error (Only a part of a ReadProcessMemory or WriteProcessMemory request has completed).
Does anyone have an idea ??