Results 1 to 6 of 6

Thread: [RESOLVED] AGAIN Playing mp3 files in VB6

  1. #1

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Resolved [RESOLVED] AGAIN Playing mp3 files in VB6

    In a previous post "Playing mp3 files in VB6" I got some great advise to do the job. It worked fine. I need to go beyond that. The original solution played an mp3 file that was resident on the computer. Can this code be modified if the file is resident on the internet? I do have the link which conveniently also ends in .mp3

    Thanks

  2. #2

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: AGAIN Playing mp3 files in VB6

    I have decided to withdraw this post. I will not pursue this method.

    Thanks

    Since I don't know how to withdraw, I will mark as resolved.

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: [RESOLVED] AGAIN Playing mp3 files in VB6

    Moved from Codebank to main forum. Codebank is meant for submissions rather than questions.

    If you've decided not to proceed then you've done the best thing by marking the thread resolved. It indicates that you no longer require a response but it does leave the question up here which might provoke some useful discussion by other members.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] AGAIN Playing mp3 files in VB6

    In case anybody comes along looking for answers here is one possibility:

    Code:
    Option Explicit
    '
    'More complicated than otherwise requried because we want to detect the end of
    'the MP3 we are playing.
    '
    '
    'To avoid using subclassing we can hitch a ride on some control that has an hWnd
    'property and a MouseMove event (WM_MOUSEMOVE is a friendly message for such
    'repurposing).
    '
    'Here we'll use the CommandButton cmdMediaEvents that is Visible = False so it
    'won't get real MoveMove events.
    '
    
    Private Const WM_MOUSEMOVE As Long = &H200&
    
    Private Enum EV_CODES
        'This is not an exhaustive list:
        EC_ACTIVATE = &H13&
        EC_CLOCK_CHANGED = &HD&
        EC_COMPLETE = &H1&
        EC_ERRORABORT = &H3&
        EC_PAUSED = &HE&
    End Enum
    
    Private FilgraphManager As QuartzTypeLib.FilgraphManager
    Private IMediaEventEx As QuartzTypeLib.IMediaEventEx
    
    Private Sub cmdMediaEvents_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        'Not being used as a button control, this is our NotifyWindow event handler.
        Dim EventCode As EV_CODES
        Dim Param1 As Long
        Dim Param2 As Long
    
        With IMediaEventEx
            .GetEvent EventCode, Param1, Param2, 0
            .FreeEventParams EventCode, Param1, Param2
            If EventCode = EC_COMPLETE Then Unload Me
        End With
    End Sub
    
    Private Sub Form_Load()
        Set FilgraphManager = New QuartzTypeLib.FilgraphManager
        Set IMediaEventEx = FilgraphManager
        IMediaEventEx.SetNotifyWindow cmdMediaEvents.hWnd, WM_MOUSEMOVE, 0
        With FilgraphManager
            .RenderFile "https://dl.espressif.com/dl/audio/gs-16b-2c-44100hz.mp3"
            .Run
        End With
    End Sub
    There is a lot more code there than required if you don't need to detect when playing completes.

  5. #5
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: [RESOLVED] AGAIN Playing mp3 files in VB6

    for the above, if you can't make it work, you need a reference to ActiveMovie control type library (quartz.dll)

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] AGAIN Playing mp3 files in VB6

    Yeah, good point. And "ActiveMovie control type library" has been a part of Windows for quite a long time now. Nothing to deploy unless you must support XP SP1 or earlier.

    If you need it, the redist package should be found as part of DirectX Software Development Kit but I'd grab that now if you don't have it somewhere. These downloads have a way of suddenly disappearing forever.

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