Here is a simple example. Salient points are:
You need to initialize some modules first.
You can get the default receiver from MidiDevice_Static
You only need to worry about generating Midi Messages when dealing with sequences and adding them to tracks. For real-time use it is simpler to send the messages as byte arrays.
On my device, some of the pianos sound the same, and some programs appear not to have a sound associated with them (unless they were just quiet), this may be different on each device.
Hope this helps