Guest |
Отправлено: 14.03.2006, 22:04 |
|
Не зарегистрирован
|
Нашел тут код как можно узнать расположение проигрываемого файла в Winamp-e но он оказался на VB может кто в нем шарит и сможет перевести следующий код на С++
CODE |
Public Function GetCurrentSongPath() As String
'Finds the path of the song currently playing
Dim CurrentPosition As Integer
Dim PathOfWinamp As String
Dim CurrentSongPath As String
Dim a As Integer
CurrentPosition = WritePlayList()
If CurrentPosition = -1 Then Exit Function
PathOfWinamp = GetWinampPath
If PathOfWinamp = "" Then Exit Function
a = 1
Do While InStr(a + 1, PathOfWinamp, "\")
a = a + 1
Loop
PathOfWinamp = Left(PathOfWinamp, a)
If FindWinamp = 0 Then Exit Function
If WritePlayList = -1 Then Exit Function
Open PathOfWinamp & "WINAMP.m3u" For Input As #1
Line Input #1, CurrentSongPath
For a = 1 To (CurrentPosition + 1)
Line Input #1, CurrentSongPath
Line Input #1, CurrentSongPath
Next a
Close #1
GetCurrentSongPath = CurrentSongPath
End Function
//-------------------------------------------------------------
Public Function GetWinampPath() As String
'Finds the path of winamp
Dim WinampPath As String
WinampPath = RegGetString(HKEY_CLASSES_ROOT, WINAMP_REG_KEY, "")
If Len(WinampPath) < 8 Then GetWinampPath = "": Exit Function
WinampPath = Mid(WinampPath, 2, Len(WinampPath) — 7)
GetWinampPath = WinampPath
End Function
//------------------------------------------------------------------
Public Function RegGetString$(hInKey As Long, ByVal subkey$, ByVal valname$)
'I got this from Microsoft's page and editted it a bit
'Has nothing to do with winamp, you can skip it, I use
'it in a different function
Dim RetVal$, hSubKey As Long, dwType As Long, SZ As Long, v$, r As Long
RetVal$ = ""
r = RegOpenKeyEx(hInKey, subkey$, 0, KEY_QUERY_VALUE, hSubKey)
If r <> 0 Then Exit Function
SZ = 256
v$ = String$(SZ, 0)
r = RegQueryValueEx(hSubKey, valname$, 0, dwType, ByVal v$, SZ)
If r = 0 And dwType = 1 Then
RetVal$ = Left(v$, SZ — 1)
Else
RetVal$ = ""
End If
If hInKey = 0 Then r = RegCloseKey(hSubKey)
RegGetString$ = RetVal$
End Function
//------------------------------------------------------------------------------
|
Функцию WritePlayList() я уже сам перевел , весь winamp.bas файл можно просмотреть здесь
http://www.koders.com/vb/fid392170664938AB...F14C0.aspx#L572
|
|
|