Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MIDIOutGetDevCaps

Posted on 1998-01-31
5
Medium Priority
?
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 80 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 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