Problems adding resources (icons) in Image list.

Hello,

I've been trying to create an image list of a bunch of icons. I am having
problems using the ResourceLoad and GetResource methods for the Imagelist
object.

This works:

  Icon := TIcon.Create;
  try
    Icon.Handle := LoadIcon(hInstance, 'I2COMP');
    ImageList.AddIcon(Icon);
  finally
    Icon.Free;
  end;

These both don't:

  ImageList.ResourceLoad(rtIcon, 'I2COMP', clBlack);
  ImageList.GetResource(rtIcon, 'I2COMP', 32, [], clBlack)

result of these is false, imagelist is not updated, GetLastError returns 87,
which seems to be:

  { The parameter is incorrect. }
  ERROR_INVALID_PARAMETER = 87;   { dderror }

Since I don't know which API call exactly generates this error, I am not
sure if it's meaningful, and if it is, which parameter would be the
incorrect one.

However, if I convert the 32x32 icon to a bitmap, and do:

  ImageList.ResourceLoad(rtBitmap, '2COMP', clBlack)

then it works.

Can anyone explain to me what is going wrong?

Thanks,
Martien

Chemical engineering                  | Yesterday upon the stair,
WWW/HTML design                       | I met a man who wasn't there.
Computing consultancy                 | He wasn't there again today;
http://www.tcp.chem.tue.nl/~tgtcmv/   | I wish that man would go away.