Solved

"simple" MM api question

Posted on 1998-12-30
4
183 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 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