|
-
Aug 18th, 2000, 08:59 PM
#1
Thread Starter
Hyperactive Member
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?
-
Aug 19th, 2000, 04:01 AM
#2
Fanatic Member
Yeah, my man. You should use the Windows API call ShellExecute.
-
Aug 19th, 2000, 11:50 AM
#3
Thread Starter
Hyperactive Member
Haven't worked with API at all yet so i have no idea how to go about it
-
Aug 19th, 2000, 12:23 PM
#4
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
-
Aug 19th, 2000, 12:33 PM
#5
Thread Starter
Hyperactive Member
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
-
Aug 19th, 2000, 12:38 PM
#6
Just pass the filename as the command line argument.
Code:
Shell "C:\Program Files\Windows Media Player\wmplayer.exe C:\MyMpg.mpg", vbNormalFocus
-
Aug 19th, 2000, 12:44 PM
#7
Thread Starter
Hyperactive Member
Can always count on you Megatron, the next question would be ...Does it work the same for an .AVI?
-
Aug 19th, 2000, 12:59 PM
#8
Thread Starter
Hyperactive Member
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?
-
Aug 19th, 2000, 01:08 PM
#9
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
-
Aug 19th, 2000, 01:19 PM
#10
Thread Starter
Hyperactive Member
Thanx Megatron, I'd buy ya a house but Bill Gates presently has all my funds
-
Aug 19th, 2000, 01:39 PM
#11
Thread Starter
Hyperactive Member
But now supposing someone snuck into his house and replaced his PC with a Mac, what would happen?
-
Aug 19th, 2000, 01:56 PM
#12
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.
-
Aug 19th, 2000, 02:31 PM
#13
Thread Starter
Hyperactive Member
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]
-
Sep 12th, 2000, 06:33 PM
#14
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|