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

  1. VERSION 5.00
  2. Object = "{C4941F47-8BC1-49D3-9989-2B7826F26AE6}#1.0#0"; "MSPShell.dll"
  3. Begin VB.Form FrmEncControl 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Windows Media Encoder Control Sample"
  6.    ClientHeight    =   3645
  7.    ClientLeft      =   2385
  8.    ClientTop       =   1080
  9.    ClientWidth     =   8145
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    ScaleHeight     =   3645
  13.    ScaleWidth      =   8145
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin MSPROPSHELLLibCtl.MSPropShell PageShell 
  16.       Height          =   3135
  17.       Left            =   0
  18.       OleObjectBlob   =   "EncControl.frx":0000
  19.       TabIndex        =   4
  20.       Top             =   0
  21.       Width           =   8055
  22.    End
  23.    Begin VB.CommandButton CmdExit 
  24.       Caption         =   "E&xit"
  25.       Height          =   375
  26.       Left            =   6900
  27.       TabIndex        =   0
  28.       Top             =   3240
  29.       Width           =   1155
  30.    End
  31.    Begin VB.CommandButton CmdStop 
  32.       Caption         =   "S&top"
  33.       Enabled         =   0   'False
  34.       Height          =   375
  35.       Left            =   5640
  36.       TabIndex        =   3
  37.       Top             =   3240
  38.       Width           =   1155
  39.    End
  40.    Begin VB.CommandButton CmdStart 
  41.       Caption         =   "&Start"
  42.       Height          =   375
  43.       Left            =   4380
  44.       TabIndex        =   2
  45.       Top             =   3240
  46.       Width           =   1155
  47.    End
  48.    Begin VB.CommandButton CmdConfigure 
  49.       Caption         =   "&Configure"
  50.       Height          =   375
  51.       Left            =   3120
  52.       TabIndex        =   1
  53.       Top             =   3240
  54.       Width           =   1155
  55.    End
  56. End
  57. Attribute VB_Name = "FrmEncControl"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = False
  60. Attribute VB_PredeclaredId = True
  61. Attribute VB_Exposed = False
  62. ' The one and only Encoder!
  63.  
  64. Dim Encoder As New WMEncoder
  65.  
  66. Private Sub CmdConfigure_Click()
  67.     On Error GoTo err_handler
  68.     
  69.     ' Display Configure Encoder dialog passing it our Encoder
  70.     
  71.     Set FrmConfigure.EncoderMain = Encoder
  72.     FrmConfigure.Show 1
  73.     Set FrmConfigure.EncoderMain = Nothing
  74.     
  75.     Exit Sub
  76.     
  77. err_handler:
  78.     MsgBox "Error configuring the property pages"
  79.     
  80. End Sub
  81.  
  82. Private Sub CmdExit_Click()
  83.     
  84.     ' Goodbye!
  85.     
  86.     Unload Me
  87.     
  88. End Sub
  89.  
  90. Private Sub CmdStart_Click()
  91.     On Error GoTo err_handler
  92.     
  93.     ' Start the encoder
  94.     
  95.     Encoder.Start
  96.     CmdStart.Enabled = False
  97.     CmdStop.Enabled = True
  98.     Exit Sub
  99.     
  100. err_handler:
  101.     MsgBox "Error starting the encoder"
  102.     
  103. End Sub
  104.  
  105. Private Sub CmdStop_Click()
  106.     On Error GoTo err_handler
  107.     
  108.     ' Stop the encoder
  109.     
  110.     Encoder.Stop
  111.     CmdStop.Enabled = False
  112.     CmdStart.Enabled = True
  113.     Exit Sub
  114.     
  115. err_handler:
  116.     MsgBox "Error stopping the encoder"
  117.     
  118. End Sub
  119.  
  120. Private Sub Form_Load()
  121.     On Error GoTo err_handler
  122.     
  123.     ' Create the Encoder's General Monitor Page
  124.     
  125.     Dim PpgMain As WMEncMonMainPage
  126.     Set PpgMain = New WMEncMonMainPage
  127.         
  128.     ' Add the Encoder to the Page Shell
  129.         
  130.     PageShell.AddObject Encoder
  131.     
  132.     ' Add the Monitor Page to the Page Shell
  133.     
  134.     PageShell.AddPage PpgMain
  135.     
  136.     Exit Sub
  137.  
  138. err_handler:
  139.     MsgBox "Error loading the statistics page"
  140. End Sub
  141.  
  142. Private Sub Form_Unload(Cancel As Integer)
  143.  
  144.     ' Make sure the Encoder is stopping/stopped
  145.     
  146.     If (Encoder.RunState <> WMENC_ENCODER_STOPPING) And (Encoder.RunState <> WMENC_ENCODER_STOPPED) Then
  147.       Encoder.Stop
  148.     End If
  149.     
  150.     ' Wait for it to stop if it hasn't yet
  151.     
  152.     While Encoder.RunState <> WMENC_ENCODER_STOPPED
  153.       DoEvents
  154.     Wend
  155.     
  156.     ' Release the Encoder
  157.     
  158.     Set Encoder = Nothing
  159.     
  160.     End
  161. End Sub
  162.  
  163.