Results 1 to 6 of 6

Thread: [RESOLVED] How can i open wmv files in vb 6?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Resolved [RESOLVED] How can i open wmv files in vb 6?

    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.

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: How can i open wmv files in vb 6?

    You want to open the wmv file in windows media player or in your form?
    CS

  3. #3
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: How can i open wmv files in vb 6?

    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
    CS

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Re: How can i open wmv files in vb 6?

    ok thanks alot, now the code for my form looks like this

    VB Code:
    1. 'System & API - How to open any file with its default application
    2.  
    3. Option Explicit
    4.  
    5. 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
    6.  
    7. Public Sub OpenFile(ByVal sFileName As String)
    8.     Call ShellExecute(0, "Open", sFileName, vbNullString, vbNullString, vbNormalFocus)
    9. End Sub
    10.  
    11. 'How can I call this function:
    12. 'Call OpenFile("www.gmail.com")
    13.  
    14. Private Sub Command1_Click()
    15.  
    16. End Sub

    Umm the file i want to use is called "GettingToNewBrunswick.wmv" where would i tell the code to use it.

  5. #5
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: How can i open wmv files in vb 6?

    It should be:
    VB Code:
    1. Private Sub Command1_Click()
    2. Call OpenFile("GettingToNewBrunswick.wmv") 'You have to specify the full path of the wmv file. like "C:\Temp\Testing.wmv"
    3. End Sub
    CS

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Re: How can i open wmv files in vb 6?

    thanks alot for your 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