[RESOLVED] Opening Video File using MMControl in vb
Can anybody tell me .How should i open Video file MPG/MPEG/BUP Using MMControl.i simple want to open a video file Using Bt_Open Button.and simple want to play Using Bt_Play Button.But the following Code is Not Working.
Code:
Private Sub Bt_Play_Click()
MMControl1.Wait = True
MMControl1.Command = "Play"
End Sub
Private Sub BtOpen_Click()
CommonDialog1.ShowOpen
MMControl1.FileName = CommonDialog1.FileName
MMControl1.Wait = True
MMControl1.Command = "Open"
End Sub
Still Not Working .here is the following code .What i have written.Kindly let me know the Idea.
Any help would be highly appreciated.right now i am trying to open *.Wav file.
Code:
Private Sub Bt_Play_Click()
MMControl1.Wait = True
MMControl1.Command = "Play"
End Sub
Private Sub BtOpen_Click()
CommonDialog1.ShowOpen
MMControl1.FileName = CommonDialog1.FileName
Debug.Print MMControl1.FileName
MMControl1.Wait = True
MMControl1.Command = "Open"
End Sub
Private Sub Form_Load()
Form1.Caption = MMControl1.FileName
End Sub
Last edited by firoz.raj; November 9th, 2009 at 10:50 PM.
Option Explicit
' cdlCFPrinterFonts &H2
' Save File Options
'&H2 - Forces a warning before overwriting a file
'&H8 - Stops default directory from changing
'&H200 - more than one file can be selected.
'&H1000 - This makes it so the file must exist.
'&H2000 - This warns the user before creating a new file.
Private Sub cmdOpen_Click()
' CancelError is True.
On Error GoTo ErrHandler
CommonDialog1.InitDir = App.Path
' Set Flags
CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNLongNames
' Set filters.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text" & _
"Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' CommonDialog1.Filter = "AutoForm Files (*.doc) (*.rtf)|*.doc;*.rtf|All " & _
"Files (*.*)|*.*"
' Specify default filter.
CommonDialog1.FilterIndex = 2 ' Default to TEXT
' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
' OpenFile (CommonDialog1.FileName)
Debug.Print CommonDialog1.FileName
Exit Sub
ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
Private Sub cmdShowColor_Click()
' Set Cancel to True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Set the Flags property
CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth
' Display the Font dialog box
CommonDialog1.ShowColor
rtb.BackColor = CommonDialog1.Color
Exit Sub
ErrHandler:
' User pressed the Cancel button
Exit Sub
End Sub
Private Sub cmdShowFont_Click()
' Set Cancel to True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Set the Flags property
CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth ' cdlCFPrinterFonts
' Display the Font dialog box
CommonDialog1.ShowFont
If rtb.SelLength = 0 Then
rtb.SelStart = 0
rtb.SelLength = Len(rtb.SelRTF)
End If
rtb.SelFontName = CommonDialog1.FontName
rtb.SelFontSize = CommonDialog1.FontSize
rtb.SelBold = CommonDialog1.FontBold
rtb.SelItalic = CommonDialog1.FontItalic
rtb.SelUnderline = CommonDialog1.FontUnderline
rtb.SelStrikeThru = CommonDialog1.FontStrikethru
rtb.SelColor = CommonDialog1.Color
Exit Sub
ErrHandler:
' User pressed the Cancel button
Exit Sub
End Sub
Private Sub cmdSaveFile_Click()
Dim strFileName As String
Dim ans As Integer
CommonDialog1.Flags = &H2 ' Overwrite Flag
CommonDialog1.Filter = "RTF|*.rtf|Text|*.txt"
CommonDialog1.ShowSave
On Error GoTo SaveProblems
strFileName = CommonDialog1.FileName
If CommonDialog1.FilterIndex = 1 Then
CommonDialog1.DefaultExt = "rtf"
rtb.SaveFile strFileName
Else
CommonDialog1.DefaultExt = "txt"
rtb.SaveFile strFileName, rtfText
End If
Exit Sub
SaveProblems:
MsgBox "Can’t save the file, try again.", vbCritical
Exit Sub
End Sub
Private Sub Form_Load()
Label1.Caption = "Open File into RTB " & vbCrLf & _
"Save File from RTB" & vbCrLf & _
"Show Font" & vbCrLf & _
"Change selected text" & vbCrLf & _
" or all text." & vbCrLf & _
"Show Color" & vbCrLf & _
"Change BackColor of RTB"
End Sub
Sub SaveMultipleFiles()
Dim strOrigDir As String
Dim strNewDir As String
Dim varTemp As Variant
Dim lngIdx As Long
strNewDir = "D:\Temp\"
With CommonDialog1
.Flags = cdlOFNAllowMultiselect Or cdlOFNLongNames Or cdlOFNExplorer
.ShowSave
varTemp = Split(.FileName, vbNullChar)
End With
If IsArray(varTemp) Then
If UBound(varTemp) = 0 Then
FileCopy varTemp(lngIdx), strNewDir & Right$(varTemp(lngIdx), Len(varTemp(lngIdx)) - InStrRev(varTemp(lngIdx), "\"))
Else
strOrigDir = varTemp(0)
For lngIdx = LBound(varTemp) + 1 To UBound(varTemp)
FileCopy strOrigDir & "\" & varTemp(lngIdx), strNewDir & varTemp(lngIdx)
Next
End If
End If
End Sub
Can you tell me Why *.bup Video File is Not working .Mpg/Mpeg/Mp3/WMV/WAV file is working.
But some other type of Audio File is Not Working.Kindly let me know the idea.
Code:
Private Sub Bt_Play_Click()
CommonDialog1.Filter = "VideoFile(*.mpg)|*.mpeg|ALL Files(*.*)|*.*"
CommonDialog1.ShowOpen
MMControl1.FileName = CommonDialog1.FileName
Debug.Print MMControl1.FileName
MMControl1.Wait = True
MMControl1.Command = "Open"
MMControl1.Command = "Prev"
MMControl1.Command = "PlAY"
End Sub
Private Sub Form_Load()
Form1.Caption = MMControl1.FileName
End Sub
If wet don't know what kind of file it is, then how can the MM control? What program DOES open that kind of file? I guess you would have to give that to each person, if it's free to give away. (Most are NOT)
Re: [RESOLVED] Opening Video File using MMControl in vb
This is just a thought... BUT it may be you need the codecs for the extension in question. You might be able to search for the codec using your friends (yahoo, google, ask, answers, bing) or perhaps downloading and installing Media Player Classic. Then again, I could be barking up the wrong tree...
Bookmarks