Audio player (1 Viewer)

orcone

New Member
Joined
Feb 17, 2005
Messages
2
Gender
Male
HSC
2005
Hi guys, I was just wondering if anyone here knew if it was possible to create an audio player using Visual Basic 6.
If it is possible, would I need to create an mp3, wav, ogg decoder to attain the raw data of the sound file and play it through the program?

Thanks for any help.
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
You can try and use the Media Player control and see if it suits your needs.
 

LoneShadow

Uber Procrastinator
Joined
May 24, 2004
Messages
877
Gender
Undisclosed
HSC
N/A
orcone said:
Hi guys, I was just wondering if anyone here knew if it was possible to create an audio player using Visual Basic 6.
If it is possible, would I need to create an mp3, wav, ogg decoder to attain the raw data of the sound file and play it through the program?

Thanks for any help.
use ShellExecute.

'#############################
Private Sub Form_Load()
<other code>
strPath = App.Path & "\User Manual\" 'Path of the Help File
strFileName = "LogIn.htm" 'Name of the Help File
End Sub
'#############################

'############################
Under the option explicit [above code modules:
Option Explicit

Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As String) As Long
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 Const SW_SHOWNORMAL = 1

Dim strPath As String 'Path of the help file
Dim strFileName As String 'Help file name (Log In)
'############################

'Private Sub cmdHelp_Click()
Dim strProgramName As String * 255
Dim lngFind As Long
Dim lngShell As Long

lngFind = FindExecutable(strFileName, strPath, strProgramName) 'Select approperiate program to open help file with
Select Case lngFind
Case 0
MsgBox "Not enough memory available. Please close some programs and try again."
Exit Sub
Case 1 To 30
MsgBox "The help file 'LogIn.htm' not fount in the directory" & strPath & _
".", vbOKOnly + vbCritical, "Help file not found"
Exit Sub
Case 31
MsgBox "Unable to find Web Browser."
Exit Sub
Case Is > 31
lngShell = ShellExecute(frmAPHS_SDB.hwnd, "Open", strPath & strFileName, "", "", SW_SHOWNORMAL) 'Open help file
If lngShell > 31 Then
Else
MsgBox "Unable to launch Web Browser."
End If
End Select
End Sub
'#########################
The above code is a portion of source code of my own major project; and as you can see I used this code to open a html file called "LogIn.htm" which is located in "<program directory>\User Manual\" folder. But you can make it open any file by just changing the extension of the file. You don't have to determine which program should open which file.....the extension of the file determines that. I had preassigned a file name at Form_Load() but if you want your users to select the file at run time....just assign the file name at runtime and remove the pre assigned filename at Form_Load()
 
Last edited:

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Its not much of a media player if its just going to be opening another program to play the media files....
 

LoneShadow

Uber Procrastinator
Joined
May 24, 2004
Messages
877
Gender
Undisclosed
HSC
N/A
sunny said:
Its not much of a media player if its just going to be opening another program to play the media files....

true but he wants a multi codec player....to do that u need to create something that combine RealPlayer, WM Player or QuickTime and a few other mutimedia players. I don't think any school kid be able to do that. If he wants just file types asociated with one of the above programs..then he might be able to use the Media Player control.
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
orcone said:
If it is possible, would I need to create an mp3, wav, ogg decoder to attain the raw data of the sound file and play it through the program?
Other than proprietary formats like Quicktime and RealMedia, as long as the codec is installed and the normal media player can play them, so can the media player control, like mp3 and wav.
 

LoneShadow

Uber Procrastinator
Joined
May 24, 2004
Messages
877
Gender
Undisclosed
HSC
N/A
sunny said:
Other than proprietary formats like Quicktime and RealMedia, as long as the codec is installed and the normal media player can play them, so can the media player control, like mp3 and wav.
yeah...if he keeps it to WM supported files...then he can just simply use the WM control.
 

orcone

New Member
Joined
Feb 17, 2005
Messages
2
Gender
Male
HSC
2005
LONE SHADDOW:
hey dude is it possible for u to actually send us ur actual program so we can have a look at it..did u program it in vb.net or did u program it in visual basic?
 

LoneShadow

Uber Procrastinator
Joined
May 24, 2004
Messages
877
Gender
Undisclosed
HSC
N/A
orcone said:
LONE SHADDOW:
hey dude is it possible for u to actually send us ur actual program so we can have a look at it..did u program it in vb.net or did u program it in visual basic?
I coded it vb 6. My code is a bit complex. u wouldn't get much out of it if I sent ya. u can post your problems here and we'll try to help u out.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top