Results 1 to 13 of 13

Thread: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

  1. #1

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Question How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    i already tried it with rc.exe but it supports only icons up to 128x128 pixel.

    Any ideas how to create a DLL containing multires icons with up to 256x256 pixel?

    Or is this a Windows feature only MS themself can do?

  2. #2
    Member
    Join Date
    Nov 2020
    Posts
    49

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?


  3. #3

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by LeoFar View Post
    imagemagick cant create DLLs...

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,569

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by Mith View Post
    imagemagick cant create DLLs...
    Why do you want to use a *.dll as the "container-file"?

    There's much better (non MS-specific) "Single-File-Containers" for storing resources -
    (as e.g. a Zip-archive - or an SQLite-DB or a combination of both).
    https://www.vbforums.com/showthread....ontainer-Files

    Olaf

  5. #5

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by Schmidt View Post
    Why do you want to use a *.dll as the "container-file"?
    There's much better (non MS-specific) "Single-File-Containers" for storing resources
    i dont want to use the DLL as a resource for my app. The icon DLL will be used as a icon container for file shortcuts.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,741

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Easy fix.

    RC.EXE works fine, but...

    ... you need a newer version of both RC.EXE and RCDLL.DLL, which you can obtain from either a Windows SDK for Vista or later or else some newer version of Visual Studio .Net (since there was no longer a normal VS by the time Vista came out).

    You can plop those two files wherever you want. I normally just put them in the same folder as the CMD file I use to run RC.EXE.

    No idea whether replacing VB6's files would work or cause chaos. Never tried that myself.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,741

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    BTW:

    The resulting RES files can be used with VB6, but they won't succeed in IDE runs and you can't edit them using the VB Resource Editor.

    For something odd like a 256x256 icon I'd probably use API calls to load the icon and wrap it as a StdPicture, draw it using DrawIconEx() if I wanted full alpha transparency.

    I'd choose LoadIconWithScaleDown() which does a cleaner job scaling if necessary. Then detect IDE runs and load from the ICO file instead of the resource (in compiled runs), since you don't want to try to load the icon from the resources of VB6.EXE

  8. #8

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Lightbulb Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by dilettante View Post
    ... you need a newer version of both RC.EXE and RCDLL.DLL, which you can obtain from either a Windows SDK for Vista or later
    Thanks a lot for this information! Now i can create DLLs with 256x256 icons!

    Here are my instructions to get the files RC.EXE and RCDLL.DLL without installing the SDK:

    1. download the Windows 10 SDK (10.0.20348.0), version 2104: Download from MS
    2. open the ISO and extract the file e3d1b35aecfccda1b4af6fe5988ac4be.cab from inside the Installer folder.

    X86:
    1. open the file e3d1b35aecfccda1b4af6fe5988ac4be.cab
    2. Extract the file fil17653af63e678f34fa846c5778be8a0a and rename it to rc.exe
    3. Extract the file filb9ee06b9b5730331372b6ec09b556153 and rename it to rcdll.dll

    X64:
    1. open the file 69661e20556b3ca9456b946c2c881ddd.cab
    2. Extract the file fil17653af63e678f34fa846c5778be8a0a and rename it to rc.exe
    3. Extract the file filb9ee06b9b5730331372b6ec09b556153 and rename it to rcdll.dll

    I have tested the X86 and x64 versions with Win7x64, both are working!

    Some bonus information about how to create the DLL:

    1. create the file icons.rc with a list of all your icons
    2. create the file icons.res using the command: rc.exe /r /fo icons.res /v icons.rc
    3. create the file icons.dll using the command: "C:\Program Files (x86)\Microsoft Visual Studio\VB98\link.exe" /out:icons.dll /dll /machine:x86 /noentry icons.res

    now u will have a DLL file with all your icons inside
    Last edited by Mith; Jul 31st, 2021 at 10:26 PM. Reason: add some more infos

  9. #9

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by dilettante View Post
    For something odd like a 256x256 icon I'd probably use API calls to load the icon and wrap it as a StdPicture, draw it using DrawIconEx() if I wanted full alpha transparency.
    Currently i use the following APIs to retrieve a 32bit icon from a external DLL:

    1. LoadLibraryExW
    2. FindResourceW
    3. LoadResource
    4. CreateIconFromResourceEx

    Now i want to add the 32bit icon to the VBBCR ImageList that support 32bit icons.
    For the ImageList i must use the following command to add a new icon:
    imlTest.ListImages.Add 1, "k1", {StdPicture-Object}
    the internal add-function of the ImageList is declared as:
    Public Function Add(Optional ByVal Index As Long, Optional ByVal Key As String, Optional ByVal Picture As IPictureDisp) As ImlListImage
    How to convert the icon-handle from CreateIconFromResourceEx to IPictureDisp (StdPicture?) without loosing the 32bit-transparency?

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,741

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    LoadLibrary() is good enough to load the DLL and get its hInstance (module handle). Ideally you will call FreeLibrary() to release it when you no longer need the module.

    LoadIconWithScaleDown() just needs the hInstance of the DLL and the INTRESOURCE of the desired icon within it.

    Once you have the hIcon you can use OleCreatePictureIndirect() to wrap it as an IPicture object. There should be plenty of examples of that in threads here.

  11. #11

    Thread Starter
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    182

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    I stripped my code down to:

    LoadLibraryW
    LoadIconWithScaleDown
    OleCreatePictureIndirect

    Now i can add the 32-bit icons to the VBCCR ImageList!

    Thx for your help!

  12. #12
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,563

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by Mith View Post
    Currently i use the following APIs to retrieve a 32bit icon from a external DLL:

    1. LoadLibraryExW
    2. FindResourceW
    3. LoadResource
    4. CreateIconFromResourceEx

    Now i want to add the 32bit icon to the VBBCR ImageList that support 32bit icons.
    For the ImageList i must use the following command to add a new icon:

    the internal add-function of the ImageList is declared as:


    How to convert the icon-handle from CreateIconFromResourceEx to IPictureDisp (StdPicture?) without loosing the 32bit-transparency?
    StdPicture is not transparent,stdpictureEX.CLS,YOU CAN TRY
    '来源:https://www.vbforums.com/showthread....t=StdPictureEx

  13. #13
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    3,218

    Re: How to create a multires icon DLL with sizes up to 256x256 like shell32.dll?

    Quote Originally Posted by Mith View Post
    Now i can add the 32-bit icons to the VBCCR ImageList!
    There is a ColorDepth property on ImageList control that defaults to ImlColorDepth24Bit -- try changing this to ImlColorDepth32Bit before adding first image.

    Also note that the only way to keep the alpha channel in a 32-bit image with OleCreatePictureIndirect is to use icon sub-type i.e. 32-bit DIB inside a vbPicTypeIcon.

    cheers,
    </wqw>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width