home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / address / recordit.frm < prev    next >
Text File  |  1993-07-05  |  4KB  |  122 lines

  1. VERSION 2.00
  2. Begin Form RecordIt 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Voice Recorder"
  5.    ClientHeight    =   1110
  6.    ClientLeft      =   2835
  7.    ClientTop       =   3150
  8.    ClientWidth     =   3015
  9.    Height          =   1515
  10.    Left            =   2775
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   1110
  15.    ScaleWidth      =   3015
  16.    Top             =   2805
  17.    Width           =   3135
  18.    Begin CommandButton Command1 
  19.       Caption         =   "&Start"
  20.       FontBold        =   -1  'True
  21.       FontItalic      =   0   'False
  22.       FontName        =   "Arial"
  23.       FontSize        =   9.75
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       Height          =   375
  27.       Left            =   720
  28.       TabIndex        =   1
  29.       Top             =   480
  30.       Width           =   1575
  31.    End
  32.    Begin Label Label1 
  33.       AutoSize        =   -1  'True
  34.       Caption         =   "Ready ....."
  35.       FontBold        =   -1  'True
  36.       FontItalic      =   0   'False
  37.       FontName        =   "Arial"
  38.       FontSize        =   12
  39.       FontStrikethru  =   0   'False
  40.       FontUnderline   =   0   'False
  41.       ForeColor       =   &H000000FF&
  42.       Height          =   285
  43.       Left            =   240
  44.       TabIndex        =   0
  45.       Top             =   120
  46.       Width           =   1095
  47.    End
  48. End
  49.  
  50. Sub Command1_Click ()
  51. If Command1.Caption = "&Start" Then
  52.     If Not MMSend%("Record talk") Then
  53.         y% = MMSend%("close talk")
  54.         RecordIt.Tag = "NO"
  55.         RecordIt.Hide
  56.         Exit Sub
  57.     Else
  58.         Label1.Caption = "Recording ......"
  59.         Label1.Refresh
  60.         Command1.Caption = "&Stop"
  61.         Command1.Refresh
  62.     End If
  63. Else
  64.     If Not MMSend%("stop talk") Then
  65.         y% = MMSend%("close talk")
  66.         RecordIt.Tag = "NO"
  67.         RecordIt.Hide
  68.         Exit Sub
  69.     Else
  70.         Command1.Enabled = False
  71.         Label1.Caption = "Stopped .... Saving"
  72.         Label1.Refresh
  73.         If Address.Label14.Caption <> "" Then
  74.             xx$ = Address.Label14.Caption
  75.             Address.Label14.Caption = ""
  76.             On Error Resume Next
  77.             Kill xx$
  78.         End If
  79.         Randomize
  80.         'pick a unique file name
  81.         Do
  82.             TheNum& = Int(65000 * Rnd)
  83.             TheString$ = CStr(TheNum&)
  84.             TheString$ = "V" & TheString$
  85.             TheFile$ = ThePath & TheString$ & ".wav"
  86.             If Dir$(TheFile$) = "" Then Exit Do
  87.         Loop
  88.         SaveCmd$ = "save talk " & TheFile$
  89.         If Not MMSend%(SaveCmd$) Then
  90.             y% = MMSend%("close talk")
  91.             RecordIt.Tag = "NO"
  92.             RecordIt.Hide
  93.             Exit Sub
  94.         Else
  95.             y% = MMSend%("close talk")
  96.             RecordIt.Tag = "YES"
  97.             Address.Label14.Caption = TheFile$  'make sure to update label14
  98.             RecordIt.Hide
  99.         End If
  100.     End If
  101. End If
  102. End Sub
  103.  
  104. Sub Form_Load ()
  105. 'if can't open then hide form
  106. If Not MMSend%("open new type waveaudio alias talk") Then
  107.     RecordIt.Tag = "NO"
  108.     RecordIt.Hide
  109.     Exit Sub
  110. End If
  111. RecordIt.Top = Address.Top + ((Address.Height - RecordIt.Height) \ 3)
  112. RecordIt.Left = Address.Left + ((Address.Width - RecordIt.Width) \ 2)
  113. End Sub
  114.  
  115. Sub Form_Unload (Cancel As Integer)
  116. 'must make sure we are closed here. if not mmsystem will
  117. 'reload the form and start running it again. must be a
  118. 'call back set up ???
  119. y% = MMSend%("close talk")
  120. End Sub
  121.  
  122.