Hi,
Here an example for playing all midi Instruments, that I use it for my contest entry Vaders, maybe you like it.

P - play all midi Instruments
Esc - exit

Any comments are welcome.

Code:
  //Created by rojart 2009
#include <acknex.h>
#define API(name,lib)  #define PRAGMA_API name;lib!name
#define DECLARE_HANDLE(name) typedef HANDLE name
#define CALLBACK_NULL 0x0

DECLARE_HANDLE(HMIDIOUT);
HMIDIOUT hMidiout;

DWORD __stdcall midiOutOpen(DWORD*,DWORD,DWORD,DWORD,DWORD);
DWORD __stdcall midiOutShortMsg(DWORD,DWORD);
DWORD __stdcall midiOutReset(DWORD);
DWORD __stdcall midiOutClose(DWORD);

API(midiOutOpen,winmm)
API(midiOutShortMsg,winmm)
API(midiOutReset,winmm)
API(midiOutClose,winmm)

int midiport = 0;

int on_p_event()
{
	int i; BYTE octave = 60; BYTE volume = 127;
	
	for(i=0;i<=127;i++)
	{
		midiOutShortMsg(hMidiout, (volume << 16) | (i          << 8) | 0xC0);wait(1);  // Instrument
		midiOutShortMsg(hMidiout, (volume << 16) | (octave     << 8) | 0x90);wait(-1); // note/octave on
		midiOutShortMsg(hMidiout, (volume << 16) | (octave     << 8) | 0x80);wait(1);  // note off
	}
}

void main()
{
	midiOutOpen(&hMidiout, midiport, 0, 0, CALLBACK_NULL);
}

void on_esc_event()
{
	wait(1);
	midiOutReset(hMidiout);wait(1);
	midiOutClose(hMidiout);wait(1);
	sys_exit(NULL);
}



Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P