devxlogo

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

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

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.