Click here to Skip to main content
11,640,445 members (64,576 online)
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 3:13am
irzyxa411
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 Mika Wendelius 300
1 CPallini 209
2 OriginalGriff 165
3 Sergey Alexandrovich Kryukov 139
4 Afzaal Ahmad Zeeshan 130
0 Mika Wendelius 200
1 OriginalGriff 145
2 CPallini 115
3 jgakenhe 40
4 sasanka sekhar panda 30


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 24 Oct 2012
Copyright © CodeProject, 1999-2015
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