Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / BabyAnim / BabyNew.Bas

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $OPTION EXPLICIT
     $INCLUDE "RapidQ.inc"
     DECLARE FUNCTION mciSendString LIB "winmm.dll" ALIAS "mciSendStringA" (BYVAL lpstrCommand AS STRING, BYVAL lpstrReturnString AS STRING, BYVAL uReturnLength AS LONG, BYVAL hwndCallback AS LONG) AS LONG
     DECLARE FUNCTION sndPlaySound LIB "winmm.dll" ALIAS "sndPlaySoundA" (BYVAL lpszSoundName AS STRING, BYVAL Uflags AS LONG) AS LONG
     DECLARE FUNCTION MediaLength() AS LONG
     DECLARE FUNCTION CurrentPos() AS LONG
     DECLARE FUNCTION IsPlaying() AS INTEGER
     DECLARE FUNCTION MediaStatus() AS STRING
     DECLARE SUB StartShow()
     DECLARE SUB CloseShow()
     DECLARE SUB BabySitterTimer()
     DIM Extension AS STRING
     DIM Filename AS STRING
     DIM CheckPointCharlie AS LONG
     DIM BmpFile(0 TO 82) AS STRING
     BmpFilE( 0)="RKARL00.BMP"
     BmpFilE( 1)="RKARL01.BMP"
     BmpFilE( 2)="RKARL02.BMP"
     BmpFilE( 3)="RKARL03.BMP"
     BmpFilE( 4)="RKARL04.BMP"
     BmpFilE( 5)="RKARL05.BMP"
     BmpFilE( 6)="RKARL06.BMP"
     BmpFilE( 7)="RKARL07.BMP"
     BmpFilE( 8)="RKARL08.BMP"
     BmpFilE( 9)="RKARL09.BMP"
     BmpFilE(10)="RKARL10.BMP"
     BmpFilE(11)="RKARL11.BMP"
     BmpFilE(12)="RKARL12.BMP"
     BmpFilE(13)="RKARL13.BMP"
     BmpFilE(14)="RKARL14.BMP"
     BmpFilE(15)="RKARL15.BMP"
     BmpFilE(16)="RKARL16.BMP"
     BmpFilE(17)="RKARL17.BMP"
     BmpFilE(18)="RKARL18.BMP"
     BmpFilE(19)="RKARL19.BMP"
     BmpFilE(20)="RKARL20.BMP"
     BmpFilE(21)="RKARL21.BMP"
     BmpFilE(22)="RKARL22.BMP"
     BmpFilE(23)="RKARL23.BMP"
     BmpFilE(24)="RKARL24.BMP"
     BmpFilE(25)="RKARL25.BMP"
     BmpFilE(26)="RKARL26.BMP"
     BmpFilE(27)="RKARL27.BMP"
     BmpFilE(28)="RKARL28.BMP"
     BmpFilE(29)="RKARL29.BMP"
     BmpFilE(30)="RKARL30.BMP"
     BmpFilE(31)="RKARL31.BMP"
     BmpFilE(32)="RKARL32.BMP"
     BmpFilE(33)="RKARL33.BMP"
     BmpFilE(34)="RKARL34.BMP"
     BmpFilE(35)="RKARL35.BMP"
     BmpFilE(36)="RKARL36.BMP"
     BmpFilE(37)="RKARL37.BMP"
     BmpFilE(38)="RKARL38.BMP"
     BmpFilE(39)="RKARL39.BMP"
     BmpFilE(40)="RKARL40.BMP"
     BmpFilE(41)="RKARL41.BMP"
     BmpFilE(42)="RKARL42.BMP"
     BmpFilE(43)="RKARL43.BMP"
     BmpFilE(44)="RKARL44.BMP"
     BmpFilE(45)="RKARL45.BMP"
     BmpFilE(46)="RKARL46.BMP"
     BmpFilE(47)="RKARL47.BMP"
     BmpFilE(48)="RKARL48.BMP"
     BmpFilE(49)="RKARL49.BMP"
     BmpFilE(50)="RKARL50.BMP"
     BmpFilE(51)="RKARL51.BMP"
     BmpFilE(52)="RKARL52.BMP"
     BmpFilE(53)="RKARL53.BMP"
     BmpFilE(54)="RKARL54.BMP"
     BmpFilE(55)="RKARL55.BMP"
     BmpFilE(56)="RKARL56.BMP"
     BmpFilE(57)="RKARL57.BMP"
     BmpFilE(58)="RKARL58.BMP"
     BmpFilE(59)="RKARL59.BMP"
     BmpFilE(60)="RKARL60.BMP"
     BmpFilE(61)="RKARL61.BMP"
     BmpFilE(62)="RKARL62.BMP"
     BmpFilE(63)="RKARL63.BMP"
     BmpFilE(64)="RKARL64.BMP"
     BmpFilE(65)="RKARL65.BMP"
     BmpFilE(66)="RKARL66.BMP"
     BmpFilE(67)="RKARL67.BMP"
     BmpFilE(68)="RKARL68.BMP"
     BmpFilE(69)="RKARL69.BMP"
     BmpFilE(70)="RKARL70.BMP"
     BmpFilE(71)="RKARL71.BMP"
     BmpFilE(72)="RKARL72.BMP"
     BmpFilE(73)="RKARL73.BMP"
     BmpFilE(74)="RKARL74.BMP"
     BmpFilE(75)="RKARL75.BMP"
     BmpFilE(76)="RKARL76.BMP"
     BmpFilE(77)="RKARL77.BMP"
     BmpFilE(78)="RKARL78.BMP"
     BmpFilE(79)="RKARL79.BMP"
     BmpFilE(80)="RKARL80.BMP"
     BmpFilE(81)="RKARL81.BMP"
     BmpFilE(82)="RKARL82.BMP"



     CREATE Form AS QFORM
      CAPTION = "Form1"
      Width = 276
      Height = 218
      Center
      BorderStyle=BsNone
      CREATE Karlsson AS QIMAGE
       BMP = "Karlsson.bmp"
       Left = 0
       Top = 0
       Width = 276
       Height = 218
       AutoSize = 1
      END CREATE
      CREATE Arena AS QIMAGE
       BMP = "Arena.bmp"
       Left = 32
       Top = 22
       Width = 201
       Height = 148
       AutoSize = 1
      END CREATE
      CREATE ShowOn AS QBUTTON
       CAPTION = ""
       BMP = "Plutt.bmp"
       Left = 175
       Top = 189
       Width = 36
       Height = 16
       ShowHint = 1
       Hint = "Start The Show"
       OnClick=StartShow
       Enabled=True
      END CREATE
      CREATE ShowClose AS QBUTTON
       CAPTION = ""
       BMP = "Plutt.bmp"
       Left = 208
       Top = 189
       Width = 36
       Height = 16
       ShowHint = 1
       Hint = "Close The Show and exit"
       TabOrder = 1
       OnClick=CloseShow
      END CREATE
     END CREATE
     CREATE BabySitter AS QTIMER
      Interval = 80
      Enabled = 0
      Ontimer=BabySitterTimer
     END CREATE


     SUB StartShow
      Arena.Visible=TRue
      Filename = "Fyllebarnets_Hambo.mid"
      mciSendString ("open "  & Filename + " alias mmfile", "", 0, 0)
      mciSendString ("Play "  & Filename & ,"loop",0,0)
      ShowOn.Enabled=False
      DO
       DOEVENTS
       BabySitterTimer
       SLEEP .2
      LOOP
     END SUB

     SUB CloseShow
      IF MediaStatus = "PLAYING" OR MediaStatus = "PAUSED" OR MediaStatus = "STOPPED" THEN
       mciSendString "close mmfile", "", 0, 0
      END IF
      BabySitter.Enabled=False
      Form.CLOSE
      END
     END SUB

     FUNCTION MediaStatus() AS STRING
      DIM lNullChar AS INTEGER, sStatus AS STRING * 255
      mciSendString "status mmfile mode", sStatus, 255, 0
      lNullChar = INSTR(sStatus, CHR$(0))
      MediaStatus = UCASE$(LEFT$(sStatus, lNullChar - 1))
     END FUNCTION

     SUB BabySitterTimer()
      STATIC Index AS INTEGER
      DOEVENTS
      Arena.Bmp = BmpFile(Index)
      Arena.Enabled=True
      Index = Index + 1
      IF Index=82 THEN
       mciSendString "close mmfile", "", 0, 0
       mciSendString ("open "  & Filename + " alias mmfile", "", 0, 0)
       mciSendString ("Play "  & Filename ,"",0,0)
      END IF
      IF Index >= 83 THEN Index = 0
     END SUB

     FUNCTION MediaLength() AS LONG
      DIM sLength AS STRING * 255, lNullChar AS LONG
      mciSendString "status mmfile length", sLength, 255, 0

    'To find the null character position
      lNullChar = INSTR(sLength, CHR$(0))

    'Return the length of the media
      MediaLength = CLNG(VAL(LEFT$(sLength, lNullChar - 1)))
     END FUNCTION

     FUNCTION CurrentPos() AS LONG
      DIM lNullChar AS LONG, sCurPos AS STRING * 255
      mciSendString "status mmfile position", sCurPos, 255, 0
      lNullChar = INSTR(sCurPos, CHR$(0))
      CurrentPos = CLNG(VAL(LEFT$(sCurPos, lNullChar - 1)))
     END FUNCTION

     Form.SHOWMODAL
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2019-4-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:46:42