Click here to Skip to main content
15,883,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
smags13 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 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 5-Oct-12 10:23am    
I don't solved it :(

it's my example on Delphi
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;
 
Share this answer
 
ImageList_Replace (-1,HIcon) will add an icon to the END of the ImageList...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900