Solved

"simple" MM api question

Posted on 1998-12-30
4
180 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
Comment Utility
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
Comment Utility
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
Comment Utility
Have solved the above problem

Enjoy the points!
0
 
LVL 2

Expert Comment

by:trillo
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now