Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is it possible to add a movie to a form using VB.Net?
Posted
Updated 15-Mar-12 7:46am
v2

Here is the sample code:

VB
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Private Sub Form_Click()
Dim Ret As Long, A$, x As Integer, y As Integer
    x = 0
    y = 0
    A$ = "C:\Windows\Movie.avi" 'Change the path and filename
    Ret = mciSendString("stop movie", 0&, 128, 0)
    Ret = mciSendString("close movie", 0&, 128, 0)
    Ret = mciSendString("open AVIvideo!" & A$ & " alias movie parent " & Form1.hWnd & " style child", 0&, 128, 0)
    Ret = mciSendString("put movie window client at " & x & " " & y & " 0 0", 0&, 128, 0)
    Ret = mciSendString("play movie", 0&, 128, 0)
End Sub

Private Sub Form_Terminate()
Dim Ret As Long
    Ret = mciSendString("close all", 0&, 128, 0)
End Sub
 
Share this answer
 
Sure, you can embed Windows Media Player control in your form. Please see:
http://msdn.microsoft.com/en-us/library/bb383953%28v=vs.90%29.aspx[^].

—SA
 
Share this answer
 
Comments
Member 11001628 2-Sep-14 0:01am    
How to open video from hyperlinked file in Vb.net
Sergey Alexandrovich Kryukov 2-Sep-14 0:22am    
It depends on what is it. What's the problem, the lack of URL?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900