Results 1 to 14 of 14

Thread: Starting a .MPG

  1. #1

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    OK i know this is an incredibly simple question but i want to start a .MPG by clicking a command button in my application but i can't get the SHELL command to do it, Should i be using a different command?

  2. #2
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    Yeah, my man. You should use the Windows API call ShellExecute.

  3. #3

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Haven't worked with API at all yet so i have no idea how to go about it

  4. #4
    Guest
    Why not use Windows Media Player? Add it to your componets list and use the following commands to play/stop it.

    Code:
    'To play a file
    MediaPlayer1.filename = "C:\windows\desktop\combat.mpg"
    MediaPlayer1.Play
    
    'To stop playing
    MediaPlayer.Stop

  5. #5

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    That works as long as i put Media Player in my application i just wanted to start the particular .mpg seperately, matter of fact i was going to unload the form as soon as i started the .mpg

  6. #6
    Guest
    Just pass the filename as the command line argument.
    Code:
    Shell "C:\Program Files\Windows Media Player\wmplayer.exe C:\MyMpg.mpg", vbNormalFocus

  7. #7

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Can always count on you Megatron, the next question would be ...Does it work the same for an .AVI?

  8. #8

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    ok i can open an .avi in Media Player the same way, but what if space aliens had deleted the users Media Player, is there anyway to start the file in whatever is available?

  9. #9
    Guest
    To open any file with it's default App, use the ShelExecute API.
    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Sub Command1_Click()
        ShellExecute hwnd, "open", "C:\MyAVI.avi", "", "", 1
    End Sub

  10. #10

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Thanx Megatron, I'd buy ya a house but Bill Gates presently has all my funds

  11. #11

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    But now supposing someone snuck into his house and replaced his PC with a Mac, what would happen?

  12. #12
    Guest
    With the splitting up of Microsoft, Gate's wealth will decrease significantly seeing how he's only allowed to own stock in one company.

    Also, VB will not work on a Mac, however there are other sorts of BASIC for the Mac such as Applesoft Basic.

  13. #13

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Don't think I'll worry about Mac, I was just supposin'...
    So now another question, I'm using Media Player in my app., Is there any way i can package Media Player with my app. so if the user, for some ungodly reason, doesn't have it installed my program will still run from the CD?

    For this project i wasn't planning on installing anything on the users HD, it's a demo that'll run off the CD, in other words i wasn't going to make a setup file

    [Edited by PJB on 08-19-2000 at 10:09 PM]

  14. #14
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    How about playing MediaPlayer WITHOUT the MM control?

    Hey Megatron! Appreciate the help you've given so far. One question, If I want to allow my LAN users to click on a button & have the DEFAULT media player(which SHOULD be Windows Media Player-since we're Win98/NT <g>) launch & play a file that has been stored in a Network DB on a Server, can this code do that? Or is that even possible? Thanks for any help!

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