FGIW3: Visual Basic Version


'*****************************************************************************
'                                                                            *
'  FGIW3.frm                                                                 *
'                                                                            *
'  This example shows how to play an AVI file from an FGI library, using     *
'  either fgi_showavi() or the low-level fgi_avixxx() routines.              *
'                                                                            *
'*****************************************************************************
Dim hPal As Long
Dim hVB As Long, hFGI As Long
Dim cxClient As Long, cyClient As Long
Dim Context(48) As Byte
Private Sub Form_Activate()
   Call fg_realize(hPal)
   Refresh
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
   Screen.MousePointer = 11
   Call fgi_showavi("CLOCK.AVI", 2, 0, hFGI)
   Screen.MousePointer = 0
ElseIf KeyCode = vbKeyF2 Then
   Screen.MousePointer = 11
   Call fg_aviskip(Context(0), -1)
   While fg_aviplay(Context(0), 1, 0) > 0
      Call fg_vbscale(0, fg_getmaxx(), 0, fg_getmaxy(), 0, cxClient - 1, 0, cyClient - 1)
   Wend
   Call fg_aviskip(Context(0), -1)
   While fg_aviplay(Context(0), 1, 0) > 0
      Call fg_vbscale(0, fg_getmaxx(), 0, fg_getmaxy(), 0, cxClient - 1, 0, cyClient - 1)
   Wend
   Screen.MousePointer = 0
End If
End Sub
Private Sub Form_Load()
   ScaleMode = 3
   Call fg_setdc(hDC)
   hPal = fg_defpal()
   Call fg_realize(hPal)
   Call fg_vbinit
   Call fg_vbdepth(16)
   hVB = fg_vballoc(148, 148)
   Call fg_vbopen(hVB)
   Call fg_vbcolors
   hFGI = fgi_open(App.Path & "\EXAMPLE.FGI")
   If hFGI = 0 Then
      Call MsgBox("Unable to open FGI file.", vbCritical, "Error")
      Unload Me
      Exit Sub
   End If
   Call fgi_aviopen("CLOCK.AVI", Context(0), hFGI)
   Call fg_aviplay(Context(0), 1, 0)
End Sub
Private Sub Form_Paint()
   Call fg_vbscale(0, fg_getmaxx(), 0, fg_getmaxy(), 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub Form_Resize()
   cxClient = ScaleWidth
   cyClient = ScaleHeight
   Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
   Call fgi_avidone(Context(0))
   Call fgi_close(hFGI)
   Call fg_vbclose
   Call fg_vbfree(hVB)
   Call fg_vbfin
End Sub

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.