DlgInOut.Filter = "Windows Media files(*.wmv;*.wma)|*.wmv;*.wma|Windows Media video files(*.wmv)|*.wmv|Windows Media audio files(*.wma)|*.wma|Windows Media (*.asf)|*.asf"
DlgInOut.Flags = cdlOFNHideReadOnly
DlgInOut.ShowSave
TxtOutput.Text = DlgInOut.FileName
DlgInOut.FileName = ""
End If
Exit Sub
Err_Handler:
MsgBox "Error Opening File", vbExclamation
End Sub
Private Sub CmdCancel_Click()
InputFile = ""
Unload Me
End Sub
Private Sub CmdOk_Click()
On Error GoTo Err_Handler
If TxtInput.Text = "" Then
MsgBox "Please enter the input file"
TxtInput.SetFocus
Exit Sub
End If
If CmbProfile.Text = "" Then
MsgBox "Please enter a profile"
CmbProfile.SetFocus
Exit Sub
End If
If TxtOutput = "" Then
OutputFile = "None"
Else
OutputFile = TxtOutput.Text
End If
InputFile = TxtInput.Text
Profile = CmbProfile.Text
Unload Me
Exit Sub
Err_Handler:
MsgBox "Error In Input"
End Sub
Private Sub Form_Load()
Dim PrfEncoder As WMEncoder
Dim PrfCol As IWMEncProfileCollection
Dim Prf As IWMEncProfile
On Error GoTo Err_Handler
InputFile = ""
OutputFile = ""
Profile = ""
Set PrfEncoder = New WMEncoder
Set PrfCol = PrfEncoder.ProfileCollection
For Each Prf In PrfCol
CmbProfile.AddItem Prf.Name
Next
CmbProfile.Text = CmbProfile.List(0)
Set PrfEncoder = Nothing
Exit Sub
Err_Handler:
MsgBox "Error Getting Profiles of Encoder", vbCritical, "Error-" & Err.Number
End Sub
Private Sub TxtInput_Change()
If (Len(TxtInput.Text)) = 1 Then
If TxtInput.Text = " " Then
TxtInput.Text = ""
End If
End If
End Sub
Public Property Get GetProfile() As String
GetProfile = Profile
End Property
Private Sub TxtInput_LostFocus()
Dim PrfEncoder As WMEncoder
Dim PrfCol As IWMEncProfileCollection
Dim Prf As IWMEncProfile
Dim SrcGrpCol As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup
Dim AudCnt As Integer
Dim VidCnt As Integer
Dim CurrentProf As String
Dim ModifiedProf As String
Dim CntPrf As Integer
If TxtInput.Text = "" Then
Exit Sub
End If
Set PrfEncoder = New WMEncoder
Set SrcGrpCol = PrfEncoder.SourceGroupCollection
Set SrcGrp = SrcGrpCol.Add("SrcList")
SrcGrp.AutoSetFileSource (TxtInput.Text)
Set PrfCol = PrfEncoder.ProfileCollection
AudCnt = SrcGrp.SourceCount(WMENC_AUDIO)
VidCnt = SrcGrp.SourceCount(WMENC_VIDEO)
CurrentProf = CmbProfile.Text
If AudCnt > 0 And VidCnt > 0 Then
CmbProfile.Clear
For Each Prf In PrfCol
If Prf.MediaCount(WMENC_AUDIO) > 0 And Prf.MediaCount(WMENC_VIDEO) > 0 Then
CmbProfile.AddItem Prf.Name
End If
Next
CmbProfile.Text = CmbProfile.List(0)
CntPrf = CmbProfile.ListCount
While CntPrf >= 0
ModifiedProf = CmbProfile.List(CntPrf)
If UCase(ModifiedProf) = UCase(CurrentProf) Then
CmbProfile.Text = CmbProfile.List(CntPrf)
Exit Sub
End If
CntPrf = CntPrf - 1
Wend
End If
If AudCnt > 0 And VidCnt = 0 Then
CmbProfile.Clear
For Each Prf In PrfCol
If Prf.MediaCount(WMENC_AUDIO) > 0 And Prf.MediaCount(WMENC_VIDEO) = 0 Then
CmbProfile.AddItem Prf.Name
End If
Next
CntPrf = CmbProfile.ListCount
While CntPrf >= 0
ModifiedProf = CmbProfile.List(CntPrf)
If UCase(ModifiedProf) = UCase(CurrentProf) Then
CmbProfile.Text = CmbProfile.List(CntPrf)
Exit Sub
End If
CntPrf = CntPrf - 1
Wend
End If
If AudCnt = 0 And VidCnt = 0 Then
MsgBox "The input file doesnot contain Either an audio or a video"
End If
End Sub
'Public Property Let Getprofile(ByVal vNewValue As Variant)
'
'End Property
Private Sub TxtOutput_Change()
If (Len(TxtOutput.Text)) = 1 Then
If TxtOutput.Text = " " Then
TxtOutput.Text = ""
End If
End If
End Sub
Public Property Get GetInputFile() As Variant
GetInputFile = InputFile
End Property
'Public Property Let GetInputFile(ByVal vNewValue As Variant)
'
'End Property
Public Property Get GetOutputFile() As Variant
GetOutputFile = OutputFile
End Property
'Public Property Let GetOutputFile(ByVal vNewValue As Variant)