Results 1 to 2 of 2

Thread: HOWTO Shutdown/Terminate Windows MediaPlayer from VB program?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98
    Sheesh..seems I’ve managed to stump the experts here!

    What I’m Trying to do in my VB networked program is use ShellExecute to launch the Windows Media Player, and then shut it down from the program.

    First the code to LAUNCH:

    Dim ItemFile As String
    ItemFile = "Training1.mpg"
    Call ShellExecute(hwnd, "Open", ItemFile, "", App.Path & "\Items\", 1)
    bIsPlaying = True ' SETS THE MULTIMEDIA FLAG!!!

    So now I have the Media running; what I WANT to have happen is when the user clicks the “Next Item” button, code in the click event ENDS/CLOSES/KILLS the Windows Media Player!

    I’ve looked at the SendMessage, TerminateProcess, and CloseHandle API calls but NONE of them work! Does ANYONE have an idea of how to simply close the MediaPlayer with code from the VB program that will work in Windows 98 AND NT 4.0?? I’d really appreciate any help. Thanks!

  2. #2
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149

    Smile Send Message

    Have you tried?

    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hwndNewParent As Long) As Long
    Private Const WM_CLOSE = &H10

    Terminate = SendMessage(hWnd, WM_CLOSE, 0, 0)

    It works for me in Win98

    Matthew ([email protected])
    VB6 Pro

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