it's my example on Delphi
function GetImageListSH(SHIL_FLAG:Cardinal): HIMAGELIST;
type
_SHGetImageList = function (iImageList: integer; const riid: TGUID; var ppv: Pointer): hResult; stdcall;
var
Handle: THandle;
SHGetImageList: _SHGetImageList;
begin
Result:= 0;
Handle:= LoadLibrary('Shell32.dll');
if Handle<>S_OK then
try
SHGetImageList:=GetProcAddress(Handle, PChar(727));
if Assigned(SHGetImageList) and (Win32Platform=VER_PLATFORM_WIN32_NT) then
SHGetImageList(SHIL_FLAG, IID_IImageList, Pointer(Result));
finally
FreeLibrary(Handle);
end;
end;
procedure TFmMain.bTestClick(Sender: TObject);
var
ImageList: HIMAGELIST;
Ico: TIcon;
Res: Integer;
begin
if odPicture.Execute then
begin
ImageList := GetImageListSH(SHIL_JUMBO);
Ico := TIcon.Create;
try
ico.LoadFromFile(odPicture.FileName);
Res := ImageList_AddIcon(ImageList,Ico.Handle);
ShowMessage(IntToStr(Res));
finally
ico.Free;
end;
end;
end;