home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / vbasic / Data / Utils / WME71SDK.exe / RCDATA / CABINET / frmaddfiles.frm < prev    next >
Text File  |  2001-03-02  |  9KB  |  331 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form FrmAddFiles 
  4.    Caption         =   "Add Batch Items"
  5.    ClientHeight    =   3045
  6.    ClientLeft      =   2100
  7.    ClientTop       =   2535
  8.    ClientWidth     =   7920
  9.    Icon            =   "FrmAddFiles.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3045
  14.    ScaleWidth      =   7920
  15.    Begin VB.CommandButton CmdCancel 
  16.       Cancel          =   -1  'True
  17.       Caption         =   "Cancel"
  18.       Height          =   495
  19.       Left            =   6240
  20.       TabIndex        =   9
  21.       Top             =   2520
  22.       Width           =   1455
  23.    End
  24.    Begin VB.CommandButton CmdOk 
  25.       Caption         =   "Ok"
  26.       Default         =   -1  'True
  27.       Height          =   495
  28.       Left            =   4440
  29.       TabIndex        =   8
  30.       Top             =   2520
  31.       Width           =   1455
  32.    End
  33.    Begin VB.Frame FraInput 
  34.       Caption         =   "INPUT"
  35.       Height          =   2055
  36.       Left            =   0
  37.       TabIndex        =   10
  38.       Top             =   240
  39.       Width           =   7815
  40.       Begin MSComDlg.CommonDialog DlgInOut 
  41.          Left            =   6480
  42.          Top             =   1320
  43.          _ExtentX        =   847
  44.          _ExtentY        =   847
  45.          _Version        =   393216
  46.       End
  47.       Begin VB.CommandButton CmdBrowse 
  48.          Caption         =   "Browse"
  49.          Height          =   375
  50.          Index           =   1
  51.          Left            =   6360
  52.          TabIndex        =   5
  53.          Top             =   840
  54.          Width           =   1095
  55.       End
  56.       Begin VB.CommandButton CmdBrowse 
  57.          Caption         =   "Browse"
  58.          Height          =   375
  59.          Index           =   0
  60.          Left            =   6360
  61.          TabIndex        =   2
  62.          Top             =   240
  63.          Width           =   1095
  64.       End
  65.       Begin VB.TextBox TxtOutput 
  66.          Height          =   315
  67.          Left            =   1200
  68.          TabIndex        =   4
  69.          Top             =   840
  70.          Width           =   5055
  71.       End
  72.       Begin VB.TextBox TxtInput 
  73.          Height          =   315
  74.          Left            =   1200
  75.          TabIndex        =   1
  76.          Top             =   240
  77.          Width           =   5055
  78.       End
  79.       Begin VB.ComboBox CmbProfile 
  80.          Height          =   315
  81.          Left            =   1200
  82.          TabIndex        =   7
  83.          Top             =   1440
  84.          Width           =   5055
  85.       End
  86.       Begin VB.Label LblOutput 
  87.          Caption         =   "&Output File :"
  88.          Height          =   375
  89.          Left            =   240
  90.          TabIndex        =   3
  91.          Top             =   840
  92.          Width           =   975
  93.       End
  94.       Begin VB.Label LblInput 
  95.          Caption         =   "&Input File :"
  96.          Height          =   375
  97.          Left            =   240
  98.          TabIndex        =   0
  99.          Top             =   240
  100.          Width           =   975
  101.       End
  102.       Begin VB.Label LblProfile 
  103.          Caption         =   "&Profile :"
  104.          Height          =   375
  105.          Left            =   240
  106.          TabIndex        =   6
  107.          Top             =   1440
  108.          Width           =   855
  109.       End
  110.    End
  111. End
  112. Attribute VB_Name = "FrmAddFiles"
  113. Attribute VB_GlobalNameSpace = False
  114. Attribute VB_Creatable = False
  115. Attribute VB_PredeclaredId = True
  116. Attribute VB_Exposed = False
  117. Option Explicit
  118. Dim InputFile As String
  119. Dim OutputFile As String
  120. Dim Profile As String
  121.  
  122. Private Sub CmbProfile_Change()
  123.     If (Len(CmbProfile.Text)) = 1 Then
  124.         If CmbProfile.Text = " " Then
  125.             CmbProfile.Text = ""
  126.          End If
  127.     End If
  128. End Sub
  129.  
  130. Private Sub CmbProfile_Click()
  131.     Profile = CmbProfile.Text
  132. End Sub
  133.  
  134. Private Sub CmdBrowse_Click(Index As Integer)
  135.    On Error GoTo Err_Handler
  136.     If Index = 0 Then
  137.         DlgInOut.DialogTitle = "Input File"
  138.         DlgInOut.Filter = "Video Files(*.asf,*.avi,*.bmp,*.mpg,*.wmv)|*.asf;*.avi;*.bmp;*.mpg;*.wmv|Audio Files(*.asf,*.avi,*.mp3,*.mpg,*.wav,*.wma)|*.asf;*.avi;*.mp3;*.mpg;*.wav;*.wma"
  139.         DlgInOut.Flags = cdlOFNFileMustExist
  140.         DlgInOut.ShowOpen
  141.         TxtInput.Text = DlgInOut.FileName
  142.         DlgInOut.FileName = ""
  143.         TxtInput.SetFocus
  144.     Else
  145.          DlgInOut.DialogTitle = "output file"
  146.          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"
  147.          DlgInOut.Flags = cdlOFNHideReadOnly
  148.          DlgInOut.ShowSave
  149.          TxtOutput.Text = DlgInOut.FileName
  150.          DlgInOut.FileName = ""
  151.     End If
  152.     
  153.     
  154.     Exit Sub
  155. Err_Handler:
  156.     MsgBox "Error Opening File", vbExclamation
  157.         
  158. End Sub
  159.  
  160.  
  161. Private Sub CmdCancel_Click()
  162.     InputFile = ""
  163.     Unload Me
  164. End Sub
  165.  
  166. Private Sub CmdOk_Click()
  167.     On Error GoTo Err_Handler
  168.     
  169.     If TxtInput.Text = "" Then
  170.         MsgBox "Please enter the input file"
  171.         TxtInput.SetFocus
  172.         Exit Sub
  173.     End If
  174.     If CmbProfile.Text = "" Then
  175.         MsgBox "Please enter a profile"
  176.         CmbProfile.SetFocus
  177.         Exit Sub
  178.     End If
  179.     
  180.     If TxtOutput = "" Then
  181.         OutputFile = "None"
  182.     Else
  183.         OutputFile = TxtOutput.Text
  184.    
  185.     End If
  186.     InputFile = TxtInput.Text
  187.     Profile = CmbProfile.Text
  188.     Unload Me
  189.     Exit Sub
  190. Err_Handler:
  191.     MsgBox "Error In Input"
  192. End Sub
  193.  
  194. Private Sub Form_Load()
  195.     Dim PrfEncoder As WMEncoder
  196.     Dim PrfCol As IWMEncProfileCollection
  197.     Dim Prf As IWMEncProfile
  198.     
  199.     On Error GoTo Err_Handler
  200.     
  201.     InputFile = ""
  202.     OutputFile = ""
  203.     Profile = ""
  204.     
  205.     Set PrfEncoder = New WMEncoder
  206.     Set PrfCol = PrfEncoder.ProfileCollection
  207.     
  208.     
  209.     For Each Prf In PrfCol
  210.         CmbProfile.AddItem Prf.Name
  211.     Next
  212.     CmbProfile.Text = CmbProfile.List(0)
  213.     Set PrfEncoder = Nothing
  214.     Exit Sub
  215. Err_Handler:
  216.     MsgBox "Error Getting Profiles of Encoder", vbCritical, "Error-" & Err.Number
  217.     
  218. End Sub
  219.  
  220. Private Sub TxtInput_Change()
  221.         If (Len(TxtInput.Text)) = 1 Then
  222.         If TxtInput.Text = " " Then
  223.             TxtInput.Text = ""
  224.          End If
  225.     End If
  226. End Sub
  227.  
  228. Public Property Get GetProfile() As String
  229.     GetProfile = Profile
  230. End Property
  231.  
  232. Private Sub TxtInput_LostFocus()
  233.     Dim PrfEncoder As WMEncoder
  234.     Dim PrfCol As IWMEncProfileCollection
  235.     Dim Prf As IWMEncProfile
  236.     Dim SrcGrpCol As IWMEncSourceGroupCollection
  237.     Dim SrcGrp As IWMEncSourceGroup
  238.     
  239.     Dim AudCnt As Integer
  240.     Dim VidCnt As Integer
  241.     Dim CurrentProf As String
  242.     Dim ModifiedProf As String
  243.     Dim CntPrf As Integer
  244.     
  245.     If TxtInput.Text = "" Then
  246.         Exit Sub
  247.     End If
  248.     
  249.     Set PrfEncoder = New WMEncoder
  250.     Set SrcGrpCol = PrfEncoder.SourceGroupCollection
  251.     Set SrcGrp = SrcGrpCol.Add("SrcList")
  252.     SrcGrp.AutoSetFileSource (TxtInput.Text)
  253.     Set PrfCol = PrfEncoder.ProfileCollection
  254.     
  255.     AudCnt = SrcGrp.SourceCount(WMENC_AUDIO)
  256.     VidCnt = SrcGrp.SourceCount(WMENC_VIDEO)
  257.         
  258.     CurrentProf = CmbProfile.Text
  259.     
  260.     
  261.     If AudCnt > 0 And VidCnt > 0 Then
  262.         CmbProfile.Clear
  263.         For Each Prf In PrfCol
  264.             If Prf.MediaCount(WMENC_AUDIO) > 0 And Prf.MediaCount(WMENC_VIDEO) > 0 Then
  265.                 CmbProfile.AddItem Prf.Name
  266.             End If
  267.         Next
  268.         CmbProfile.Text = CmbProfile.List(0)
  269.         
  270.         CntPrf = CmbProfile.ListCount
  271.         While CntPrf >= 0
  272.             ModifiedProf = CmbProfile.List(CntPrf)
  273.         
  274.             If UCase(ModifiedProf) = UCase(CurrentProf) Then
  275.                 CmbProfile.Text = CmbProfile.List(CntPrf)
  276.                 Exit Sub
  277.             End If
  278.             CntPrf = CntPrf - 1
  279.         Wend
  280.     
  281.     End If
  282.      If AudCnt > 0 And VidCnt = 0 Then
  283.         CmbProfile.Clear
  284.         For Each Prf In PrfCol
  285.             If Prf.MediaCount(WMENC_AUDIO) > 0 And Prf.MediaCount(WMENC_VIDEO) = 0 Then
  286.                 CmbProfile.AddItem Prf.Name
  287.             End If
  288.         Next
  289.         CntPrf = CmbProfile.ListCount
  290.         While CntPrf >= 0
  291.             ModifiedProf = CmbProfile.List(CntPrf)
  292.         
  293.             If UCase(ModifiedProf) = UCase(CurrentProf) Then
  294.                 CmbProfile.Text = CmbProfile.List(CntPrf)
  295.                 Exit Sub
  296.             End If
  297.             CntPrf = CntPrf - 1
  298.         Wend
  299.     End If
  300.     If AudCnt = 0 And VidCnt = 0 Then
  301.         MsgBox "The input file doesnot contain Either an audio or a video"
  302.     End If
  303. End Sub
  304.  
  305. 'Public Property Let Getprofile(ByVal vNewValue As Variant)
  306. '
  307. 'End Property
  308. Private Sub TxtOutput_Change()
  309.     If (Len(TxtOutput.Text)) = 1 Then
  310.         If TxtOutput.Text = " " Then
  311.             TxtOutput.Text = ""
  312.          End If
  313.     End If
  314. End Sub
  315.  
  316. Public Property Get GetInputFile() As Variant
  317.     GetInputFile = InputFile
  318. End Property
  319.  
  320. 'Public Property Let GetInputFile(ByVal vNewValue As Variant)
  321. '
  322. 'End Property
  323.  
  324. Public Property Get GetOutputFile() As Variant
  325.     GetOutputFile = OutputFile
  326. End Property
  327.  
  328. 'Public Property Let GetOutputFile(ByVal vNewValue As Variant)
  329. '
  330. 'End Property
  331.