home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / greeting / greeting.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  3.9 KB  |  135 lines

  1. Type GreetingMasterForm From SampleMasterForm
  2.   Dim lblGreetings As New Label
  3.   Dim LargeFont As New Font
  4.   Dim btnPlay As New Button
  5.   Dim GreetingTimer As New Timer
  6.  
  7.   ' METHODS for object: GreetingMasterForm
  8.   Sub btnPlay_Click()
  9.     ResetApplication_Click
  10.   
  11.     ' Now we move the greetings into position
  12.     lblGreetings.Top = GreetingMasterForm.Top + GreetingMasterForm.ScaleHeight
  13.     lblGreetings.Left = (GreetingMasterForm.ScaleWidth / 2) - (lblGreetings.Width / 2)
  14.     lblGreetings.Visible = True
  15.   
  16.     ' Initialize and present the greetings message
  17.     GreetingTimer.Enabled = True
  18.   
  19.     ' Play the games greeting
  20.     PlayGreetings
  21.   End Sub
  22.  
  23.   Sub GreetingTimer_Timeout()
  24.     Dim target_top As Integer
  25.   
  26.     App.AutoBusySignal = False
  27.     target_top = (GreetingMasterForm.ScaleHeight - lblGreetings.Height) / 2
  28.   
  29.     ' Move the welcome sign up 60 pixels at a time
  30.     lblGreetings.Top = lblGreetings.Top - 60
  31.     lblGreetings.Refresh
  32.   
  33.     ' If the greeting sign is in position, turn off the timer
  34.     If lblGreetings.Top <= target_top Then GreetingTimer.Enabled = False
  35.     App.AutoBusySignal = True
  36.   
  37.   End Sub
  38.  
  39.   Sub Load()
  40.     ' Restore prerequisite objects that are shared with other
  41.     ' samples, and therefore may already be loaded.
  42.     If FindObject("AudioPlayer") = Nothing Then 
  43.       LoadTextObject(SampleDir & "audio.eto")
  44.     End If
  45.   
  46.   End Sub
  47.  
  48.   Sub PlayGreetings()
  49.     Dim option As long
  50.     Dim result As long
  51.     Dim greeting_part1 As String
  52.     Dim greeting_part2 As String
  53.   
  54.     greeting_part1 = SampleDir & "professr.wav"
  55.     greeting_part2 = SampleDir & "wargames.wav"
  56.     result = AudioPlayer.sndPlaySoundA(greeting_part1, option)
  57.     result = AudioPlayer.sndPlaySoundA(greeting_part2, option)
  58.   End Sub
  59.  
  60.   Sub ResetApplication_Click
  61.     ' First of all we need to hide the greeting message and preposition it
  62.     lblGreetings.Visible = False
  63.   End Sub
  64.  
  65. End Type
  66.  
  67. Type AudioPlayer
  68.   Dim SND_SYNC As Long
  69.   Dim SND_ASYNC As Long
  70.   Dim SND_NODEFAULT As Long
  71.   Dim SND_MEMORY As Long
  72.   Dim SND_LOOP As Long
  73.   Dim SND_NOSTOP As Long
  74.   Declare Function sndPlaySoundA Lib "Winmm" (ByVal file As String, ByVal opt As Long) As Long
  75.  
  76.   ' METHODS for object: AudioPlayer
  77.   Function Play(file As String) As Long
  78.     Play = sndPlaySoundA(file, SND_ASYNC Or SND_NODEFAULT)
  79.   End Function
  80.  
  81.   Function PlaySync(file As String) As Long
  82.     Play = sndPlaySoundA(file, SND_SYNC Or SND_NODEFAULT)
  83.   End Function
  84.  
  85. End Type
  86.  
  87. Begin Code
  88. ' Reconstruction commands for object: GreetingMasterForm
  89. '
  90.   With GreetingMasterForm
  91.     .Caption := "BOOT CAMP Games Demonstration"
  92.     .BackColor := 0
  93.     .Move(5265, 1170, 7185, 5250)
  94.     .SampleDir := "W:\bootcamp\basic\greeting\"
  95.     .SampleName := "greeting"
  96.     With .lblGreetings
  97.       .Caption := "Welcome to the Games Demonstration"
  98.       .ForeColor := 16750080
  99.       .Font := GreetingMasterForm.LargeFont
  100.       .ZOrder := 1
  101.       .Move(607, 990, 5850, 2520)
  102.       .Visible := False
  103.       .Alignment := "Center"
  104.     End With  'GreetingMasterForm.lblGreetings
  105.     With .LargeFont
  106.       .FaceName := "vtspecl_132_dblhiwide"
  107.       .Size := 36.000000
  108.       .Bold := True
  109.       .Italic := False
  110.       .Strikethru := False
  111.     End With  'GreetingMasterForm.LargeFont
  112.     With .btnPlay
  113.       .Caption := "Play"
  114.       .ZOrder := 2
  115.       .Move(5850, 150, 1050, 450)
  116.     End With  'GreetingMasterForm.btnPlay
  117.     With .GreetingTimer
  118.       .Interval := 1
  119.     End With  'GreetingMasterForm.GreetingTimer
  120.     With .helpfile
  121.       .FileName := "W:\bootcamp\basic\greeting\greeting.hlp"
  122.     End With  'GreetingMasterForm.helpfile
  123.   End With  'GreetingMasterForm
  124. ' Reconstruction commands for object: AudioPlayer
  125. '
  126.   With AudioPlayer
  127.     .SND_SYNC := 0
  128.     .SND_ASYNC := 1
  129.     .SND_NODEFAULT := 2
  130.     .SND_MEMORY := 4
  131.     .SND_LOOP := 8
  132.     .SND_NOSTOP := 16
  133.   End With  'AudioPlayer
  134. End Code
  135.