Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mp3 link in VB program

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I want to create a link in my VB program that will play MP3 files when the user clicks on them. The program creates the text that then goes to a web server and becomes the site.

Does anyone know how to write this link?

Thanks.

Mindy
 
Launch File With His Associate Program

'This example will show you how to launch a file with his associate program.
'It will do the same action that occur when you Double Click on the file.
'For Example, if when you double click on mp3 file it launch with Winamp,
'This code will do the same.
'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert this code to the module :

#If Win32 Then
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
Declare Function GetDesktopWindow Lib "user32" () As Long
#Else
Declare Function ShellExecute Lib "SHELL" (ByVal hwnd%, _
ByVal lpszOp$, ByVal lpszFile$, ByVal lpszParams$, _
ByVal lpszDir$, ByVal fsShowCmd%) As Integer
Declare Function GetDesktopWindow Lib "USER" () As Integer
#End If
Public Const SW_SHOWNORMAL = 1

'Insert this code to your form:

Function StartDoc(DocName As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)
End Function

Private Sub Form_Load()
Dim r As Long
'Replace the c:\mp3\song.mp3 with the file you want to launch
r = StartDoc("c:\mp3\song.mp3")
End Sub


Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top