Solved

"simple" MM api question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now