[python-win32] Accessing Midi Devices from Win 2000

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Sep 8 09:19:20 CEST 2004


[Ian Dickinson]

> I am interested in communicating with a midi 
> device using python and Windows 2000
[... snip ...]
> I have done a bit of investigation and was wondering if I could access 
> the windows API mciSendString from python.

OK. I know nothing about how to access Midi from Windows, so
hopefully someone else will be able to help there. But to
answer your most immediate question: yes, you can, if you
use ctypes (http://starship.python.net/crew/theller/ctypes/)
But it'll be a messy business trying to define all the
data structures etc., and I bet someone's already done
the hard work somewhere.

Have you tried the main Python list on comp.lang.python?

<dump>

Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.windll.winmm
<WinDLL 'winmm', handle 77570000 at 7f8788>
>>> ctypes.windll.winmm.mciSendString
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python23\Lib\site-packages\ctypes\__init__.py", line 255, in
__getattr__
    self._name = name
AttributeError: function 'mciSendString' not found
>>> ctypes.windll.winmm.mciSendStringA
<ctypes._StdcallFuncPtr object at 0x0077FA80>
>>> ctypes.windll.winmm.mciSendStringW
<ctypes._StdcallFuncPtr object at 0x0077FAD8>
>>>

</dump>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list