Instead of using a string, it'd be easier to use DBpro's MAKE MEMORY() function.
Example:
Load Dll "WINMM.DLL",1
lphmo = Make Memory(4)
if Call DLL(1,"midiOutOpen", lphmo, DeviceID, 0, 0, 0) = 0
Print "Midi Out port succesfully opened"
else
Print "Could not open Midi Out port"
endif
sync
wait key
rem to get the handle of the Midi Out port:
hmo As DWORD
hmo = *lphmo
Delete Memory lphmo
rem create a message
event = 144
lo = (8192)+event
vel = 127
hi=vel*65536
Message=lo+hi
rem put it out
Call Dll 1, "midiOutShortMsg", hmo, Message
X