PDA

View Full Version : Can someone help me? Please!!


xincale
26th June 2002, 10:45
I add a file(*.m3u) to WINAMP PLAYLIST with below code.
1¡¢Most of time,it work well when state of WINAMP be normal.but,the file dont be added to PlAYLIST sometimes
2¡¢the file alway dont be added to PlAYLIST when state of WINAMP be minimized.
Why? Can someone help me?
Thanks

Xincale 2002.06.26

Public Sub WinAMP_AddFileToPlayList(Filename As String)
'Adds a file to the playlist

'hWndWinamp is a property of this ClASS
If hWndWinamp = 0 Then 'can't find Winamp
Exit Sub
End If

Dim cds As COPYDATASTRUCT
cds.dwData = waAddFile
' = 100 (IPC_PLAYFILE)
cds.lpData = lstrcpy(Filename, Filename)
' Copies filename to itself. Nothing happens,
' but returns the address for the pointer to the string!
cds.cbData = Len(Filename) + 1
' Reserve space for filename plus trailing null char

RetVal = CopyDataSendMessage(hWndWinamp, WM_COPYDATA, 0&, cds)

End Sub

Gourou
26th June 2002, 23:05
*works on it* but, I dunno, I cant recreate your problem, I have no problem adding to the playlist, whether winamp is minimized or not, and it always works :(

xincale
27th June 2002, 02:56
Problem be solve

modify the code:
Change "cds.cbData = Len(Filename) + 1" to "cds.cbData = LenB(Filename) + 1"

Now,it work well.
Mey be,the reason is about coding of system, double byte?

Gourou
27th June 2002, 03:46
could be that your file system is coming in as unicode, yeah