Creating a midi file

How to write a midi file to change sound banks in Quad Cortex?

I would like for the midi track, for example in the second minute of the song, to set QC to:
folder: 3
Bank: 1C
Scene G

Can anyone help?