Solved

MIDIOutGetDevCaps

Posted on 1998-01-31
5
334 Views
Last Modified: 2008-02-01
I try this simple thing;

y = midiOutGetDevCaps(0, MIDIOUTCAPS, 1024)
Text1.Text = y

but get an byref argument mismatch at the MIDIOUTCAPS
Can you help?

0
Comment
Question by:CATT
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 20 total points
ID: 1454644
You can't use a type directly in a call like the one above.  You have to create a variable of that type.  For example:

Dim MIC As MIDIOUTCAPS

'Set your MIDIOUTCAPS options here

y = midiOutGetDevCaps(0, MIC, 1024)

This should solve the problem.
0
 

Author Comment

by:CATT
ID: 1454645
well ok, but I get a 0, zero, return.
Do I read it wrong?

0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1454646
1.  Is 0 an actual Device ID of a midi device?  If not, this is probably where you are getting your error.  If no device is specified, then it can't query the device.

2.  Instead of using the constant 1024 for the size of your MIDIOUTCAPS structure, use the actual size.  You can do this with the Len() function.  Like this:

Dim MIC As MIDIOUTCAPS
Dim lMIC As Long

'Set MIDIOUTCAPS options here if you need too.

lMIC = Len(MIC)

y = midiOutGetDevCaps(uDeviceID, MIC, lMIC)

3.  Is y defined as any type of variable.  Some API calls won't return a value to a variable unless it is explicitly defined.  This is usually the case with strings, but can also happen with long values.
0
 

Author Comment

by:CATT
ID: 1454647
0 should be ok, checked with midioutgetnumdevs, what returns 2. I need to connect to it and use midioutopen, but need to tell wich mididevice to use. I need both an address and an identifier. Guess the 2 I get gives me one of them, but am I not to read the  MIDIOUTCAPS content for that, or can you show me the way?
0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1454648
Don't think 0 is going to be alright.  The reurn of 2 is simply the number of midi devices present on your system.  That doesn't necessarily mean that they are identified as 0 and 1.  You would have to use midiOutGetID to get the proper device ID for a given device, and before you do that, you have to get a device handle, which I have no idea how to do.  As far as the address, I'm not sure which address you are looking for, so I don't know how to get it.

I think this all goes back to you needing a proper device ID for the device you are trying to retrieve information on.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

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