Results 1 to 1 of 1

Thread: how to load ico from png file?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,749

    how to load ico from png file?

    Is there an API function to load cursor from png file, like CreateIconFromFile?

    how to png to ico,ico to png by vb6 code?-VBForums
    https://www.vbforums.com/showthread....ng-by-vb6-code

    [RESOLVED] saving pictures to ico-VBForums
    https://www.vbforums.com/showthread....ictures-to-ico

    Code:
       
    Private Declare Function CreateIconFromResourceEx Lib "user32" ( _
        ByRef IconBits As Byte, _
        ByVal cbIconBits As Long, _
        ByVal fIcon As Long, _
        ByVal dwVersion As Long, _
        ByVal cxDesired As Long, _
        ByVal cyDesired As Long, _
        ByVal uFlags As Long) As Long  
    
    Bytes = OpenBinFile(Png1)
     hIcon = CreateIconFromResourceEx(Bytes(0), UBound(Bytes) + 1, WIN32_TRUE, &H30000, 0, 0, LR_DEFAULTCOLOR)
    
    
    Function OpenBinFile(filename As String, Optional ErrInfo As String) As Byte()
       '[mycode_id:1903],edittime:2011/7/11 13:27:34
    On Error Resume Next
    Dim hFile As Integer
    hFile = FreeFile
    Open filename For Binary As #hFile
    ReDim OpenBinFile(LOF(hFile) - 1)
    Get #hFile, , OpenBinFile
    Close #hFile
    End Function
    Last edited by xiaoyao; Jul 30th, 2021 at 09:26 PM.

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