Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / animateavi / animateavi.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' ---------------------------------------
' Adding a Simple AVI Animation CommCtrl
' By Don <don67geo@yahoo.com>
' ---------------------------------------
     $APPTYPE GUI: $TYPECHECK ON

     $DEFINE ACS_TRANSPARENT 2
     $DEFINE ACM_OPEN        1124
     $DEFINE ACM_PLAY        1125
     $DEFINE ACM_STOP        1126
     $DEFINE WS_VISIBLE      &H10000000
     $DEFINE WS_CHILD        &H40000000

     $DEFINE AVIWidth        272
     $DEFINE AVIHeight       60

     DECLARE FUNCTION CreateWindowEx LIB "USER32" _
      ALIAS "CreateWindowExA" _
      (dl1 AS LONG, BYVAL dl2 AS STRING, dl3 AS LONG, _
      dl4 AS LONG, dl5 AS LONG, dl6 AS LONG, _
      dl7 AS LONG, dl8 AS LONG, dl9 AS LONG, _
      dl10 AS LONG, dl11 AS LONG, dl12 AS LONG) _
      AS LONG

     DECLARE SUB LoadMe
     DECLARE SUB SwitchMe (key AS BYTE, sender AS QFORM)
     DECLARE SUB SizeMe
     DECLARE SUB UnLoadMe

     DEFLNG hAnimation, hSwitch
     DEFSTR AVIStream$ = "anicopy.avi"

     CREATE Me AS QFORM
      Borderstyle = 3
      CAPTION = "AVI Animation Control Demo"
      Height  = 120
      Width   = 278
      Center
      CREATE MySB AS QSTATUSBAR
       AddPanels "Loading..."
      END CREATE
      OnClick = SwitchMe
      OnKeyDown = SwitchMe
      OnClose   = UnloadMe
      OnResize  = SizeMe
      OnShow    = LoadMe
      SHOWMODAL
     END CREATE


     SUB LoadMe
      CALL SizeMe  ' Resize to fit all WIN version at runtime.
      hAnimation = CreateWindowEx (0, "SysAnimate32", 0, _
       WS_CHILD OR WS_VISIBLE OR ACS_TRANSPARENT, _
       0,0,AVIWidth,AVIHeight, Me.handle, 0, 0, 0)

      IF (hAnimation) THEN
       SendMessage(hAnimation, ACM_OPEN, 0, VARPTR(AVIStream$))
       SendMessage(hAnimation, ACM_PLAY,-1,-1)
       MySB.Panel(0).CAPTION = "Click on AVI to PLAY/STOP"
      ELSE
       SHOWMESSAGE "Fail to create Animation control!"
       MySB.Panel(0).CAPTION = "Fail to create Animation control!"
      END IF
     END SUB

     SUB SizeMe

      Me.Width = (Me.Width - Me.ClientWidth) + AVIWidth
      Me.Height = (Me.Height - Me.ClientHeight) + AVIHeight + MySB.Height
     END SUB

     SUB SwitchMe (key AS BYTE, sender AS QFORM)
      hSwitch = ABS(hSwitch-1)
      IF key = 27 THEN 	' ESC to Exit
       UnloadMe
      ELSEIF (hAnimation) THEN
       IF (hSwitch) THEN
        SendMessage(hAnimation, ACM_STOP, 0, 0)
        MySB.Panel(0).CAPTION = "Click to [>] PLAY animation"
       ELSE
        SendMessage(hAnimation, ACM_PLAY,-1,-1)
        MySB.Panel(0).CAPTION = "Click to [x] STOP animation"
       END IF
      END IF
     END SUB

     SUB UnloadMe
      IF (hAnimation) THEN SendMessage(hAnimation, ACM_STOP, 0,0)
      Me.CLOSE
     END SUB
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:42:33