home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-02-16  |  7.6 KB  |  277 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Filter Graph Builder"
  4.    ClientHeight    =   4575
  5.    ClientLeft      =   1320
  6.    ClientTop       =   1380
  7.    ClientWidth     =   6465
  8.    Height          =   5040
  9.    Left            =   1230
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4575
  12.    ScaleWidth      =   6465
  13.    Top             =   1005
  14.    Width           =   6645
  15.    Begin VB.CommandButton New 
  16.       Caption         =   "New"
  17.       Height          =   375
  18.       Left            =   3480
  19.       TabIndex        =   15
  20.       Top             =   840
  21.       Width           =   975
  22.    End
  23.    Begin VB.CommandButton Pause 
  24.       Caption         =   "Pause"
  25.       Height          =   375
  26.       Left            =   5280
  27.       TabIndex        =   14
  28.       Top             =   2280
  29.       Width           =   975
  30.    End
  31.    Begin VB.CommandButton Connect 
  32.       Caption         =   "Connect..."
  33.       Height          =   375
  34.       Left            =   3480
  35.       TabIndex        =   13
  36.       Top             =   2520
  37.       Width           =   975
  38.    End
  39.    Begin VB.CommandButton Render 
  40.       Caption         =   "Render"
  41.       Height          =   375
  42.       Left            =   3480
  43.       TabIndex        =   12
  44.       Top             =   1920
  45.       Width           =   975
  46.    End
  47.    Begin VB.CommandButton Add 
  48.       Caption         =   "Add..."
  49.       Height          =   495
  50.       Left            =   5280
  51.       TabIndex        =   11
  52.       Top             =   840
  53.       Width           =   975
  54.    End
  55.    Begin VB.CommandButton Source 
  56.       Caption         =   "Source"
  57.       Height          =   495
  58.       Left            =   5280
  59.       TabIndex        =   10
  60.       Top             =   120
  61.       Width           =   975
  62.    End
  63.    Begin VB.ListBox PinInfo 
  64.       Height          =   1425
  65.       Left            =   720
  66.       TabIndex        =   6
  67.       Top             =   1800
  68.       Width           =   2415
  69.    End
  70.    Begin VB.ComboBox Pins 
  71.       Height          =   315
  72.       Left            =   720
  73.       Style           =   2  'Dropdown List
  74.       TabIndex        =   5
  75.       Top             =   1200
  76.       Width           =   2415
  77.    End
  78.    Begin VB.CommandButton Stop 
  79.       Caption         =   "Stop"
  80.       Height          =   375
  81.       Left            =   5280
  82.       TabIndex        =   4
  83.       Top             =   2760
  84.       Width           =   975
  85.    End
  86.    Begin VB.CommandButton Run 
  87.       Caption         =   "&Run"
  88.       Height          =   375
  89.       Left            =   5280
  90.       TabIndex        =   3
  91.       Top             =   1800
  92.       Width           =   975
  93.    End
  94.    Begin VB.ComboBox Filters 
  95.       Height          =   315
  96.       Left            =   720
  97.       Style           =   2  'Dropdown List
  98.       TabIndex        =   1
  99.       Top             =   240
  100.       Width           =   2415
  101.    End
  102.    Begin VB.CommandButton Open 
  103.       Caption         =   "&Open"
  104.       Height          =   375
  105.       Left            =   3480
  106.       TabIndex        =   0
  107.       Top             =   240
  108.       Width           =   975
  109.    End
  110.    Begin VB.Label Label3 
  111.       Caption         =   "Info"
  112.       Height          =   255
  113.       Left            =   240
  114.       TabIndex        =   9
  115.       Top             =   1800
  116.       Width           =   375
  117.    End
  118.    Begin VB.Label Label2 
  119.       Caption         =   "Pins"
  120.       Height          =   375
  121.       Left            =   240
  122.       TabIndex        =   8
  123.       Top             =   1200
  124.       Width           =   495
  125.    End
  126.    Begin VB.Label Label1 
  127.       Caption         =   "Filters"
  128.       Height          =   255
  129.       Left            =   240
  130.       TabIndex        =   7
  131.       Top             =   240
  132.       Width           =   495
  133.    End
  134.    Begin VB.Label VendorInfo 
  135.       Height          =   255
  136.       Left            =   720
  137.       TabIndex        =   2
  138.       Top             =   720
  139.       Width           =   2415
  140.    End
  141.    Begin MSComDlg.CommonDialog CommonDialog1 
  142.       Left            =   240
  143.       Top             =   3480
  144.       _Version        =   65536
  145.       _ExtentX        =   847
  146.       _ExtentY        =   847
  147.       _StockProps     =   0
  148.       Flags           =   4096
  149.    End
  150. Attribute VB_Name = "Form1"
  151. Attribute VB_Creatable = False
  152. Attribute VB_Exposed = False
  153. Dim pMC As Object
  154. Dim pSelFilter As Object
  155. Dim pselpin As Object
  156. Dim bRunning As Boolean
  157. Private Sub Add_Click()
  158.     Set Registry.RegFilters = pMC.RegFilterCollection
  159.     Registry.Show 1
  160.     RefreshFilters
  161. End Sub
  162. Private Sub Connect_Click()
  163.     SelectPin.OtherDir = pselpin.Direction
  164.     Set SelectPin.Graph = pMC
  165.     Set SelectPin.SelFilter = pSelFilter
  166.     SelectPin.RefreshFilters
  167.     SelectPin.Show 1
  168.     If SelectPin.bOK Then
  169.         Dim p As IPinInfo
  170.         Set p = SelectPin.SelPin
  171.         pselpin.Connect p
  172.         RefreshFilters
  173.     End If
  174. End Sub
  175. Private Sub Filters_Click()
  176.     Dim pfilter As IFilterInfo
  177.     For Each pfilter In pMC.FilterCollection
  178.         If pfilter.Name = Filters.Text Then
  179.             Set pSelFilter = pfilter
  180.             VendorInfo.Caption = pfilter.VendorInfo
  181.             Pins.Clear
  182.             Dim pPin As IPinInfo
  183.             For Each pPin In pfilter.Pins
  184.                 Pins.AddItem pPin.Name
  185.             Next pPin
  186.         End If
  187.     Next pfilter
  188.     Pins.ListIndex = 0
  189. End Sub
  190. Private Sub Form_Load()
  191.     bRunning = False
  192.     Filters.Clear
  193.     Pins.Clear
  194.     Set pMC = New FilgraphManager
  195. End Sub
  196. Private Sub New_Click()
  197.     Set pSelFilter = Nothing
  198.     Set pselpin = Nothing
  199.     Set pMC = Nothing
  200.     Set pMC = New FilgraphManager
  201.     Filters.Clear
  202.     Pins.Clear
  203.     PinInfo.Clear
  204.     bRunning = False
  205. End Sub
  206. Private Sub Open_Click()
  207.     CommonDialog1.ShowOpen
  208.     pMC.RenderFile CommonDialog1.filename
  209.     RefreshFilters
  210. End Sub
  211. Private Sub Pause_Click()
  212.     pMC.Pause
  213. End Sub
  214. Private Sub Pins_Click()
  215.   On Error Resume Next
  216.   Dim pPin As IPinInfo
  217.   For Each pPin In pSelFilter.Pins
  218.     If pPin.Name = Pins.Text Then
  219.       Set pselpin = pPin
  220.       PinInfo.Clear
  221.       Dim pPinOther As IPinInfo
  222.       Set pPinOther = pPin.ConnectedTo
  223.       If Err.Number = 0 Then
  224.         PinInfo.AddItem "Connected To: " + pPinOther.Name
  225.         Dim pPeer As IFilterInfo
  226.         Set pPeer = pPinOther.FilterInfo
  227.         PinInfo.AddItem "Peer Filter: " + pPeer.Name
  228.         Dim mt As IMediaTypeInfo
  229.         Set mt = pPin.ConnectionMediaType
  230.         PinInfo.AddItem "Media Type: " + mt.Type
  231.       End If
  232.       If pPin.Direction = 0 Then
  233.         PinInfo.AddItem "Direction: Input"
  234.       Else
  235.         PinInfo.AddItem "Direction: Output"
  236.       End If
  237.     End If
  238.   Next pPin
  239. End Sub
  240. Private Sub Render_Click()
  241.     pselpin.Render
  242.     RefreshFilters
  243. End Sub
  244. Private Sub Run_Click()
  245.     If Not bRunning Then
  246.       
  247.       Dim pPosition As IMediaPosition
  248.       Set pPosition = pMC
  249.       If Err.Number = 0 Then
  250.         On Error Resume Next
  251.         pPosition.CurrentPosition = 0
  252.       End If
  253.     End If
  254.     pMC.Run
  255.     bRunning = True
  256. End Sub
  257. Private Sub Source_Click()
  258.     CommonDialog1.ShowOpen
  259.     Dim filter As Object
  260.     pMC.AddSourceFilter CommonDialog1.filename, filter
  261.     RefreshFilters
  262. End Sub
  263. Private Sub Stop_Click()
  264.     pMC.Stop
  265.     bRunning = False
  266. End Sub
  267. Public Sub RefreshFilters()
  268.     Filters.Clear
  269.     Dim pfilter As IFilterInfo
  270.     For Each pfilter In pMC.FilterCollection
  271.         Filters.AddItem pfilter.Name
  272.     Next pfilter
  273.     If Filters.ListCount > 0 Then
  274.         Filters.ListIndex = 0
  275.     End If
  276. End Sub
  277.