Using a Linked Sound Recorder Object with OLECLIEN.VBX
ID: Q87768
|
The information in this article applies to:
-
Microsoft Visual Basic Professional Edition for Windows, version 2.0
-
Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows, version 1.0
SUMMARY
The following program demonstrates the use of the Microsoft Visual
Basic OLECLIEN.VBX custom control to create a linked Sound Recorder
object.
The following OLEClient property settings are required to create a
Sound OLE object:
Setting Definition
-------------------------------------------------------------------
Class - "SoundRec"
SourceDoc - The full path of the "wave" file to use (for example:
C:\WINDOWS\CHIMES.WAV)
SourceItem - The type of sound file object. "Wave" is the only
sound format supported by the Windows operating
system version 3.1 Sound Recorder.
NOTE: Sound Recorder does not come with Microsoft Windows version 3.0. You
must have Windows version 3.1 to use this example. You must also have a
computer capable of playing wave audio sounds (.WAV files). If you do not
have a sound board, you can obtain a Windows sound driver for your PC
Speaker. For information on obtaining this driver, query on the following
words in the Microsoft Knowledge Base:
win31 and driver and speak.exe
MORE INFORMATION
The following program demonstrates how to create a linked Sound Recorder
object in Microsoft Visual Basic for Windows by using the OLECLIEN.VBX
custom control:
Step-by-Step Example
- Start Visual Basic or from the File menu, choose New Project (ALT, F, N)
if Visual Basic is already running. Form1 is created by default.
- From the File menu, choose Add File. In the Files box, select the
OLECLIEN.VBX custom control file. The OLE Client tool appears in
the Toolbox.
- Place a command button and an OLEClient control on Form1.
- Enter the following code:
Sub Command1_Click ()
OLEClient1.Class = "SoundRec"
OLEClient1.Protocol = "StdFileEditing"
OLEClient1.SourceDoc = "c:\windows\chimes.wav"
' Source Item for Sound Recorder is 'Wave', but
' Sound Recorder does not check this property so
' any value will do.
OLEClient1.SourceItem = "Wave"
OLEClient1.ServerType = 0 ' Linked.
OLEClient1.Action = 1 ' CreateFromFile.
Command1.Enabled = 0
End Sub
Sub OleClient1_DblClick ()
OLEClient1.Action = 7 ' Activate (open for editing).
End Sub
Sub Form_Unload (Cancel As Integer)
OLEClient1.Action = 9 ' Close (terminate connection).
End Sub
- Press the F5 key to run the program. Choose the Command button to create
the OLE object. Double clicking the OLEClient control starts Sound
Recorder and plays the OLE sound.
REFERENCES
"Microsoft Professional Toolkit for Visual Basic: Custom Control
Reference," pages 196-232
Additional query words:
1.00 2.00
Keywords :
Version :
Platform :
Issue type :