Solved

"simple" MM api question

Posted on 1998-12-30
4
184 Views
Last Modified: 2010-05-03
I have built a Class for Multimedia which includes play pause etc.
I am having difficulty in understanding how to save a recording held in memory to disk however.

How do i use the alias to pass the recording to a file?

Many thanks for any answers in advance
0
Comment
Question by:ewocks
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 40 total points
ID: 1453166
Use this commandstring: "save anyname c:\myfile.wav"; Where "anyname" is your alias, and the rest is obvious.
Of course I'm assuming you're using the mciSendStrign fucntion (Am I right?)

Here is a little example:
----------------------------
Private 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

Dim i As Long

Private Sub cmdPlay_Click()
    i = mciSendString("play anyname from 1", 0, 0, 0)
End Sub

Private Sub cmdRec_Click()
    i = mciSendString("record anyname to 20000", 0, 0, 0)
End Sub

Private Sub cmdStop_Click()
    i = mciSendString("stop anyname", 0, 0, 0)
End Sub

Private Sub cmdSave_Click()
    i = mciSendString("save anyname c:\myfile.wav", 0, 0, 0)
End Sub

Private Sub Form_Load()
    i = mciSendString("open new type waveaudio alias anyname", 0,  0, 0)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    i = mciSendString("close anyname", 0, 0, 0)
End Sub

----------------------------

Trillo
0
 

Author Comment

by:ewocks
ID: 1453167
Hi,
I'll give you the points for wasting your time - your answer is correct (its also what I have - except I'm using a class).

The problem I have is initializing the sound card - all I get is a system message "MMSYSTEM263 "This is not a registered MCI Device" - But I can play Wav files from explorer! any idea's?

I will post this as a seperate question if you wish

Have a good NEW YEAR

paulc@nilsys.demon.co.uk
0
 

Author Comment

by:ewocks
ID: 1453168
Have solved the above problem

Enjoy the points!
0
 
LVL 2

Expert Comment

by:trillo
ID: 1453169
Happy new year you too.

Trillo.

P.S.: Good you solved the problem, but next time, if I can help you, you don't need to put your other problems in a separate question.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question