Solved

midiOutGetID

Posted on 1998-01-31
2
281 Views
Last Modified: 2012-08-14
I need to know how to get the handle of midi output devices on my machine, for the midiOutGetID.
I use midiOutGetNumDevs to get to know how many devices I have available.
What do I do now?
How do I get their handles?
thank you.
CATT.
0
Comment
Question by:CATT
2 Comments
 
LVL 1

Accepted Solution

by:
Future earned 40 total points
ID: 1454720
Write a function similar to this.  You would use MidiOutGetDevCaps to get the capabilities of each device.
Add the following types and declarations to your program. The ID for the MIDI Mapper is always -1.  Hope this is enough to get you started.

Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

Type MIDIOUTCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * 32
        wTechnology As Integer
        wVoices As Integer
        wNotes As Integer
        wChannelMask As Integer
        dwSupport As Long
End Type


Function GetSoundBoardMIDIAudioID()  'looks for "synth" as output                                      'device
  Dim NumAuxDevs As Long
  Dim DevNum As Long
  Dim DevCaps As MIDIOUTCAPS
  Dim retval As Long, Pos As Long

  NumAuxDevs = midiOutGetNumDevs()
  GetSoundBoardMIDIAudioID = MIDI_MAPPER
  For DevNum = 0 To (NumAuxDevs - 1)
    retval = midiOutGetDevCaps(DevNum, DevCaps, 92)
    Pos = InStr(LCase$(DevCaps.szPname), "synth")
    If Pos <> 0 Then
      GetSoundBoardMIDIAudioID = DevNum
      Exit Function
    End If
  Next DevNum
End Function
0
 

Author Comment

by:CATT
ID: 1454721
No prob.  BTW, one thing you should add is PUBLIC MIDI_MAPPER = -1& along with your declarations.  Or just use -1 for the device ID instead of bothering with any of this, as far as I know all systems have the MIDI mapper installed as an output device.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

910 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

17 Experts available now in Live!

Get 1:1 Help Now