Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Delphi
I wrote NSE, I need make overlay icon. On xp it worked fine. On win 7 when I try add icon into system imagelist SHIL_JUMBO I take result -1. Why? P.S. I use interface IShellIconOverlay
Posted 7-Mar-12 4:13am
irzyxa391
Comments
smags13 at 28-Apr-12 3:53am
   
You mean you're doing Namespace Extension, correct? If it is the case, do you use IImageList inside your codes?
smags13 at 30-Apr-12 0:01am
   
I just noticed that you've posted a solution to your own question. The code you posted below looks weird to me. Have you solved your problem?
irzyxa at 5-Oct-12 10:23am
   
I don't solved it :(
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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));  //Res always equal -1
    finally
      ico.Free;
    end;
  end;
end;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

ImageList_Replace (-1,HIcon) will add an icon to the END of the ImageList...
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 230
1 PIEBALDconsult 150
2 DamithSL 125
3 BillWoodruff 108
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 24 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100