Solved

MIDIOutGetDevCaps

Posted on 1998-01-31
5
327 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
Comment Utility
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
Comment Utility
well ok, but I get a 0, zero, return.
Do I read it wrong?

0
 
LVL 5

Expert Comment

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 84
change vba from autofit to 13.5 width? 4 26
Using "ScreenUpdating" 6 44
Add and format columns in vb6 7 19
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

728 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

11 Experts available now in Live!

Get 1:1 Help Now