ExtractIconEx

  • Thread starter Thread starter WeBe
  • Start date Start date
W

WeBe

Does anyone know how to use the ExtractIconEx, or any other, function to get
a handle to an icon that is embedded in the resource?

As the Windows CE documentation for ExtractIconEx states, the nIconIndex
parameter should be -N to extract an icon that is not the first (App) icon.
However, icons in my project that I add as Embedded Resource does not seem
to be added to the app's resource table.

So, how can I get a handle to an icon that is an embedded resource?

Regards,
Staffan
 
This won't work. ExtractIconEx is a Win32 function that works with Win32
resources. It will not work with .NET embedded resources.
 
Does anyone know how to use the ExtractIconEx, or any other, function to get
a handle to an icon that is embedded in the resource?

As the Windows CE documentation for ExtractIconEx states, the nIconIndex
parameter should be -N to extract an icon that is not the first (App) icon.
However, icons in my project that I add as Embedded Resource does not seem
to be added to the app's resource table.

So, how can I get a handle to an icon that is an embedded resource?

Regards,
Staffan

You could try:

intResult = SendMessageTimeout(ipApp, WM_GETICON, ICON_SMALL, 0,
0, 1000, out ipHIcon);

ipApp is an IntPtr - the Handle to the app you need the icon
for.

Icons don't seem to be embedded in .NET apps in the same way as
the 'old days' which somebody else has pointed out.
 
Yes, I know that. But is there any other way to get a handle (hIcon) to an
embedded resource icon in compact framework?

/Staffan
 
OK, I solved it myself. What I did was to make an empty assembly and a
icons.res file and compiled the assemby on the command line with "vbc ...
/win32resource:Icons.res /out:Resources.dll".

This gives me a real resource dll that I can use with the ExtractIconEx API
to retrieve multiple icons.

/Staffan
 
Back
Top