IconToPicture – Convert an icon handle to a Picture object

IconToPicture – Convert an icon handle to a Picture object

Private Type PICTDESC    cbSize As Long    pictType As Long    hIcon As Long    hPal As LongEnd Type        Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" _    (lpPictDesc As PICTDESC, riid As Any, ByVal fOwn As Long, _    ipic As IPicture) As Long' Convert an icon handle to a Picture objectFunction IconToPicture(ByVal hIcon As Long) As Picture    Dim pic As PICTDESC    Dim guid(0 To 3) As Long        ' initialize the PictDesc structure    pic.cbSize = Len(pic)    pic.pictType = vbPicTypeIcon    pic.hIcon = hIcon    ' this is the IPicture GUID {7BF80980-BF32-101A-8BBB-00AA00300CAB}    ' we use an array of Long to initialize it faster    guid(0) = &H7BF80980    guid(1) = &H101ABF32    guid(2) = &HAA00BB8B    guid(3) = &HAB0C3000    ' create the picture,    ' return an object reference right into the function result    OleCreatePictureIndirect pic, guid(0), True, IconToPictureEnd Function

See also  How to Avoid Money Transfer Scams  

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist