Solved

MIDIOutGetDevCaps

Posted on 1998-01-31
5
340 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

829 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