hey guys on a form in a vb6 program it has a button and i want it so when one presses it it opens a wmv file. What coding could i use for it? thanks alot.
Printable View
hey guys on a form in a vb6 program it has a button and i want it so when one presses it it opens a wmv file. What coding could i use for it? thanks alot.
You want to open the wmv file in windows media player or in your form?
If you want to open a wmv file with its default application you need to use Shell Execute api. check out the link:
How to open any file with its default application
ok thanks alot, now the code for my form looks like this
VB Code:
'System & API - How to open any file with its default application Option Explicit 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 Public Sub OpenFile(ByVal sFileName As String) Call ShellExecute(0, "Open", sFileName, vbNullString, vbNullString, vbNormalFocus) End Sub 'How can I call this function: 'Call OpenFile("www.gmail.com") Private Sub Command1_Click() End Sub
Umm the file i want to use is called "GettingToNewBrunswick.wmv" where would i tell the code to use it.
It should be:VB Code:
Private Sub Command1_Click() Call OpenFile("GettingToNewBrunswick.wmv") 'You have to specify the full path of the wmv file. like "C:\Temp\Testing.wmv" End Sub
thanks alot for your help.