is there a way to get the icon (picture) of a mounted volume ?

prefered method without a plugin as always …
mainly for mac but doesnt hurt if it is windows or linux too.

any hint for this ?

thanks.

Where myFile is the root level of the drive:

tempPicture = myFile.IconImageMBS(setWidth)

Better use IconMBS for image with mask or alpha channel…

You can look into the Windows Functionality Suite (WFS) and the macoslib tool sets for icon handling. I don’t know of a way to do this under Linux and I’ve always used generic icons.

But, by simply using Christian’s MBS suite, it’s much cleaner.

About macoslib (above): This is the 32 bits version.

Can some good soul share below the URL for 64 bits version, TIA.

I found this:
https://github.com/vidalvanbergen/macoslib/tree/master-64bit

I hope this is what you want.

Thanks Alberto, but I saw nothing about 64 bits in the description, so no, this is not usable with the current versions (macOS / Xojo 2018r2) excepted in the name :frowning: or :wink: (I do not know).

I found that link here:
https://forum.xojo.com/conversation/post/345275

Here is the code to get the c:\ icon (or a file icon) to appear on Window1 in Windows 10 with API calls:
The following code is in an Action event of a pushbutton.

[code]Sub Action() Handles Action
'This examples retrieves the icon from a folder and displays it on the
'Window1 control
Dim info As SHFILEINFO ’ receives information about the file
Dim retval As Int32 ’ return value of the function

’ Retrieve information about the C:\ folder
Declare Function SHGetFileInfoA Lib “shell32.dll” (pszPath As CString, dwFileAttributes As Int32, ByRef psfi As SHFILEINFO, cbFileInfo As Int32, uFlags As Int32) As Int32
retval = SHGetFileInfoA(“C:”, FILE_ATTRIBUTE_ARCHIVE, info, info.Size, SHGFI_USEFILEATTRIBUTES Or SHGFI_TYPENAME Or SHGFI_ICON)

’ Draw the icon used for the c:\ folder in the corner of Window1
Declare Function GetDC Lib “user32.dll” (hWnd as Integer) as UInteger
Declare Function DrawIcon Lib “user32.dll” (HDC As UInteger, X as Integer, Y as Integer, hIcon as Integer) as Integer
retval = DrawIcon(GetDC(Window1.Handle), 0, 0, info.hIcon)

’ Destroy the icon handle to save resources.
Declare Function DestroyIcon Lib “user32.dll” (hIcon as Integer) as integer
retval = DestroyIcon(info.hIcon)
End Sub
[/code]

Here is the structure:

Structure SHFILEINFO hIcon as Int32 iIcon as Int32 dwAttributes as Int32 szDisplayName as String*260 szTypeName as String*80 End Structure

And here are some constants:

Public Const FILE_ATTRIBUTE_ARCHIVE as Number = &H20 Public Const SHGFI_USEFILEATTRIBUTES as Number = &H10 Public Const SHGFI_TYPENAME as Number = &H400 Public Const SHGFI_ICON as Number = &H100

Thank you Eugene !
I was hopping something like this with some declares.
As said above, my main concern is for macos for this time.
I’ve searched in apple developer but was not able to find where to get the volume icon even there.
If I ever find it, then I will have to translate it into declares but first, what is the apple function for that ?