Results 1 to 38 of 38

Thread: [VB6] Write MP3 Album Art and other tags using the Windows Property System

Threaded View

  1. #38
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,622

    Talking Re: [VB6] Write MP3 Album Art and other tags using the Windows Property System

    You could make CopyMemory 64bit-friendly by changing the "Length" parameter to "LenB(LongPtr)" but yeah, "Set" works the same provided you change the variant type to "VT_STREAM" afterwards.

    Most compact version yet:
    Code:
    Private Function WriteCover(sJPG As String, sMP3 As String, Optional sTitle As String) As Long
    Dim vpr As Variant, si2 As IShellItem2, pps As IPropertyStore
        Set vpr = SHCreateStreamOnFile(sJPG, STGM_READ)
        If Not IsEmpty(vpr) Then
            CopyMemory vpr, VT_STREAM, 2
            If SHCreateItemFromParsingName(StrPtr(sMP3), Nothing, IID_IShellItem2, si2) = S_OK Then
                si2.GetPropertyStore GPS_OPENSLOWITEM Or GPS_READWRITE, IID_IPropertyStore, pps
                If Not pps Is Nothing Then
                    If pps.SetValue(PKEY_ThumbnailStream, vpr) = S_OK Then If Len(sTitle) Then pps.SetValue PKEY_Music_AlbumTitle, CVar(sTitle)
                    pps.Commit
                End If
            End If
        End If
        WriteCover = Err.LastHResult
    End Function

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