Why midiOutOpen returns 1 (=Unspecified error) in a UWP app?

104 views Asked by At

As soon as I convert the app, the midiOutOpen function starts to return 1 on being called.

I declare it as:

VB
Shared Function midiOutOpen(ByRef lphMidiOut As IntPtr, uDevID As IntPtr, cBack As IntPtr, dwinst As IntPtr, dwFlags As UInt32) As UInt32

Is there a way to use winmm.dll/midiOutOpen from a packaged app(.appx) that can still be published to MS store? Or some other way to acquire the handle of the midi device (ID 0)?

1

There are 1 answers

0
Roy Li - MSFT On

It looks like the midiOutOpen function and other APIs like midiOutShortMsg function do not work in desktop bridge apps.

Currently, we'd suggest you use the modern MIDI from Windows.Devices.Midi Namespace. You could refer to the sample here:MIDI sample.