Controlling WinAMP (WM_COPYDATA problem)

The Collector thecollector.2k at gmail.com
Thu Jun 30 16:38:44 EDT 2005


Hi, i changed the code to this:
----------------------------------
from win32gui import FindWindow
from win32api import SendMessage
import struct
import array

hWnd = FindWindow('Winamp v1.x', None)

def packData( dwData, item ):
    global cds, lpData
    lpData = array.array('c', item)
    lpData_ad = lpData.buffer_info()[0]
    cbData = lpData.buffer_info()[1]
    cds = array.array('c', struct.pack("IIP", dwData, cbData,
lpData_ad) )
    cds_ad = cds.buffer_info()[0]
    return cds_ad

def addItemToPlaylist( item ):
    SendMessage( hWnd, 0x004A, 0, packData( 100, item ) )

file = r"C:\Party Animals - Atomic.mp3"
addItemToPlaylist( file )
----------------------------------

it's working like a charm now... I did found some other mistakes, but
the main problem was indeed solved by the 'global' thingy... so simple
(/me bangs head against the wall), thanks very much!




More information about the Python-list mailing list