See chapter 7 of The Midi Files by Rob Young published by Prentice Hall. It has heaps of information on Sysex - step by step stuff and easy to read.
I'd tell you how to do it myself only anything to do with sysex brings on this almighty headache if you know what I mean?