How to send midimessage

Good morning, everyone,
Excuse me, I’m a rookie. I have a question. I’m creating a midi plug-in. The idea is to send a midi message to a fixed port.

I’ve created the following code. the user selects in the plugin the midi port, the channel, the cc and the value. midiChannelValue, controlChangeValue and ccValue are ok.

void MidiSenderAudioProcessorEditor::onBtnSendMidiTest()
{
    auto message = MidiMessage::controllerEvent(midiChannelValue, controlChangeValue, ccValue);

  //which code should go here?
    
}

the thing is, I don’t know how to send the message. I’ve been reading the OpenDevice and SendMessage methods but they don’t work for me.

Can you guide me?

Thanks

Have you tried MidiOutput::createNewDevice()? You should first see if there are available devices before trying to blindly open them, and if not just create one (as I understand it). Take a look at the documentation