Rendering a single icon

Feb 26, 2012 at 9:37 PM

I want to render a single icon from my exe file, I'm using

 

foreach (ResourceId type in resInfo.ResourceTypes)
{
if (type.ResourceType == Kernel32.ResourceTypes.RT_GROUP_ICON)
{
foreach (Resource resource in resInfo.Resources[type])
{
IconDirectoryResource iconDir = (IconDirectoryResource)resource;

foreach (IconResource iconRes in iconDir.Icons)
{
hResImage = iconRes.Image.Image;
break;
}
}
}

but I'm getting errors all the time while executing the code, so could anyone tell me how to convert a single icon to an Image type??? Thank you

 

Feb 27, 2012 at 9:22 PM

And the errors are?

Mar 1, 2012 at 1:12 PM

Out of range exception

http://i.imgur.com/yrQJm.png

hmm am I doing something wrong?

Thank you

 

 

Mar 1, 2012 at 3:06 PM

Could be a bug. Put it in Issue Tracker and attach a repro with the executable & al.