skat
Dec 20th, 2001, 09:34 AM
Hi everybody, I want to put this control up onto a webpage, and I want to make sure it is safe for scripting and initialisation and then eventually get it certified. This will be my first time to do this...It is a control were a person can record their voice using a mic..
Can anybody who has gone through this process have a look and tell me,
1. Is this control safe for scripting and initialisation?
2. If not, how can I make it as safe as possible for a user to use?
thanks
Skat
< the code>
Private Sub MMControl1_PlayClick(Cancel As Integer)
Dim CC
CC = mciSendString("PLAY MYSOUND FROM 0 NOTIFY", 0&, 0, 0)
Label1.Caption = "Play"
Label3.Caption = ""
Label2.Caption = ""
Exit Sub
End Sub
Private Sub MMControl1_RecordClick(Cancel As Integer)
Dim CC
MySoundID = 0
CC = mciSendString("CLOSE MYSOUND", 0&, 0, 0)
CC = mciSendString("OPEN NEW TYPE WAVEAUDIO ALIAS MYSOUND", 0&, 0, 0)
MySoundID = 0
CC = mciSendString("set MYSOUND time format ms bitspersample 8 channels 1 samplespersec 11025", 0&, 0, 0)
CC = mciSendString("RECORD MYSOUND NOTIFY", 0&, 0, 0)
RecTimer.Enabled = True
Label3.Caption = "Record"
Label1.Caption = ""
Label2.Caption = ""
Exit Sub
End Sub
Private Sub MMControl1_StopClick(Cancel As Integer)
Dim CC
RecTimer.Enabled = False
CC = mciSendString("STOP MYSOUND", 0&, 0, 0)
CC = mciSendString("SEEK MYSOUND to start", 0&, 0, 0)
Label2.Caption = "Stop"
Label1.Caption = ""
Label3.Caption = ""
Exit Sub
End Sub
Private Sub RecTimer_Timer()
Call MMControl1_StopClick(0)
End Sub
Private Sub UserControl_Initialize()
'$ Set properties needed by MCI to open.
MMControl1.Enabled = True
MMControl1.Notify = True
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
'$ Open the MCI WaveAudio device.
MMControl1.Command = "Open"
End Sub
Option Explicit
'$Code added to use VB MCI control
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Can anybody who has gone through this process have a look and tell me,
1. Is this control safe for scripting and initialisation?
2. If not, how can I make it as safe as possible for a user to use?
thanks
Skat
< the code>
Private Sub MMControl1_PlayClick(Cancel As Integer)
Dim CC
CC = mciSendString("PLAY MYSOUND FROM 0 NOTIFY", 0&, 0, 0)
Label1.Caption = "Play"
Label3.Caption = ""
Label2.Caption = ""
Exit Sub
End Sub
Private Sub MMControl1_RecordClick(Cancel As Integer)
Dim CC
MySoundID = 0
CC = mciSendString("CLOSE MYSOUND", 0&, 0, 0)
CC = mciSendString("OPEN NEW TYPE WAVEAUDIO ALIAS MYSOUND", 0&, 0, 0)
MySoundID = 0
CC = mciSendString("set MYSOUND time format ms bitspersample 8 channels 1 samplespersec 11025", 0&, 0, 0)
CC = mciSendString("RECORD MYSOUND NOTIFY", 0&, 0, 0)
RecTimer.Enabled = True
Label3.Caption = "Record"
Label1.Caption = ""
Label2.Caption = ""
Exit Sub
End Sub
Private Sub MMControl1_StopClick(Cancel As Integer)
Dim CC
RecTimer.Enabled = False
CC = mciSendString("STOP MYSOUND", 0&, 0, 0)
CC = mciSendString("SEEK MYSOUND to start", 0&, 0, 0)
Label2.Caption = "Stop"
Label1.Caption = ""
Label3.Caption = ""
Exit Sub
End Sub
Private Sub RecTimer_Timer()
Call MMControl1_StopClick(0)
End Sub
Private Sub UserControl_Initialize()
'$ Set properties needed by MCI to open.
MMControl1.Enabled = True
MMControl1.Notify = True
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
'$ Open the MCI WaveAudio device.
MMControl1.Command = "Open"
End Sub
Option Explicit
'$Code added to use VB MCI control
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long