Тотальная неудачница и убийца жёстких дисков.
#post-id: 2712-05-58
#original-date: 29.12.2007 Sat
#original-time: 5:58 AM
#original-day:  2712
#original-host: WinXP Prof SP2 (Build 2600)

Ещё один интересный код...

Declare Proc FindWindowA Lib "User32.DLL" (ClassName As String, Title As Integer) As Integer
Declare Proc GetWindowTextA Lib "User32.DLL" (hWndWA As Integer, Buff As String, nBuff As Integer) As Integer

'====================================================================
Main ()
 MsgBox(GetCurrentMusic())&#59;
End

'====================================================================
' Ice Cube - Roll All Day - Windows Media Player
' WMPlayerApp
'
' Ice Cube - Roll All Day - Light Alloy
' LightAlloyFront
'
' 169. Ice Cube - Roll All Day - Winamp
' Winamp v1.x
'====================================================================
Proc GetCurrentMusic() As String
 Dim Title As String&#59;
 
 ' WinAMP, foobar2000
 Title = GetCurrentMusicApp("Winamp v1.x", True, " - Winamp")&#59;
 If Title <> "" Then Return Title&#59;
 
 ' Windows Media Player + Blogger Plugin
 Title = GetCurrentMusicApp("WMPlayerApp", False, " - Windows Media Player")&#59;
 If Title <> "" Then Return Title&#59;
 
 ' Light Alloy 2
 Title = GetCurrentMusicApp("LightAlloyFront", False, " - Light Alloy")&#59;
 If Title <> "" Then Return Title&#59;
End Proc

'====================================================================
Proc GetCurrentMusicApp(WinClass As String, StripTrackNo As Integer, TailTitle As String) As String
 Dim hWndWA As Integer&#59;
 Dim Title As String&#59;
 Dim RC As Integer&#59;
 
 hWndWA = FindWindowA(WinClass, 0)&#59;
 if (hWndWA <> 0) Then
   
   Title = Space(1025)&#59;
   RC = GetWindowTextA(hWndWA, Title, 1024)&#59;
   If (RC <> 0) Then
     
     ' Debug
     'MsgBox("Title: " + Title)&#59;
     
     ' Срезаем номер трэка.
     If StripTrackNo Then
       RC = InStr(Title, " ")&#59;
       If (RC > 0) Then Title = Mid(Title, RC + 1)&#59;
     End If
     
     RC = InStr(Title, TailTitle)&#59;
     If (RC > 0) Then Title = Left(Title, RC - 1)&#59;
     
   End If
   
 End If
 
 Return Title&#59;
End Proc