Does MidiInput & MidiOutput work on Windows?

I am creating a simple component to handle midi input. I have gone through the tutorial and it uses AudioDeviceManager to register a call back (Tutorial: Handling MIDI events). I however dont need an audioDevice Manager (as my application is Midi only). Also, I believe many of the Midi functions on the AudioDeviceManager is deprecated.

I am using the MidiInput:openDevice to open up a Midi port. However, I always get an empty object returned. Code looks simple enough, so not sure if I am missing something.

In my class, I have defined:
private:
std::unique_ptr<ComboBox> cboMidiIn;
std::unique_ptr<MidiInput> midiInputDevice;

I load up the available Midi devices using the MidiInput::getAvailableDevices() in the constructor and this works fine.

On the combobox Change event, I have the below code:

    //Get the list of input devices
    Array<MidiDeviceInfo> ipDevices = MidiInput::getAvailableDevices();
    String selectedDeviceName = cboMidiInput->getText();

    //Remove the existing callback
    if (midiInputDevice) midiInputDevice->stop();
    if (selectedDeviceName != "") {

        //Find the identifier of the selected device
        for (int deviceIdx = 0; deviceIdx < ipDevices.size(); deviceIdx++)
        {
            String deviceName = ipDevices[deviceIdx].name;
            
            if (deviceName == selectedDeviceName ) {
                String deviceIndentifier = ipDevices[deviceIdx].identifier;
                midiInputDevice = MidiInput::openDevice(deviceIndentifier, midiGen.get());
                
                if (midiInputDevice) midiInputDevice->start();
                else jassert(false);
                
                break;
            }
        }
    }

The above code snippet always returns an empty MidiInput device. Based on information on this thread, should I be using AudioDeviceManager on windows? My windows version is 10.

Is there something I am missing above?

OK. Figured this out by stepping into the openDevice function. For the benefit of others reading this thread (not sure if I can delete this thread) the object I was passing to the callback was not initialized. So the openDevice was returning an empty object.

Thanks.