hippotalamus
Grünschnabel
Hallo,
habe irgendwo hier mal nen Tut gesehen das es ermöglicht, aus Winamp Informationen zu lesen und weiterzuverarbeiten. Da ich gerne mit LCD Displays spiele habe ich mich gefragt, wie ich die Signalqualität und die Signalstärke von SkyDSL auf mein Display bekomme. Dieses wird vom Programm "DVBDATA" nur als Statusbalken dargestellt... Nach einiger Zeit des Grübelns kam ich auf folgende Idee:
Probierts mal aus
Die Variablen "Signalstaerke" und "Signalquali" enthalten die aktuellen Werte und können problemlos in eigene Projekte implementiert werden.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hWnd As Long, ByVal lpClassName As String, ByVal _
nMaxCount As Long) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" _
(ByVal lpString1 As String, ByVal lpString2 As String) _
As Long
Declare Function EnumChildWindows Lib "user32" (ByVal _
hWndParent As Long, ByVal lpEnumFunc As Long, ByVal _
lParam As Long) As Long
Const WM_GETTEXT = &HD
Const PBM_Getpos = 1032 '* Auslesen von Progressbar (SKyDSL)
Public WinampTitel As String
Public SignalStaerke As Long
Public SignalQuali As Long
Public hwndWinamp As Long, hwndSkyDSL As Long
Public Sub winamp()
Dim p_laenge As Long, p As String
hwndSkyDSL = FindWindow(vbNullString, "Datenapplikation") '* Name Fenster SKyDSL
If hwndSkyDSL = 0 Then SignalStaerke = 0
EnumChildWindows hwndSkyDSL, AddressOf EnumChildProc, ByVal 0&
hwndWinamp = FindWindow("Winamp v1.x", vbNullString)
p_laenge = GetWindowTextLength(hwndWinamp) + 1
p = Space(p_laenge)
p_laenge = GetWindowText(hwndWinamp, p, p_laenge)
'* Ungeschnittener Titel des WinampButtons *
WinampTitel = Left$(p$, p_laenge)
End Sub
Public Function EnumChildProc(ByVal hWnd As Long, ByVal lParam _
As Long) As Long
Dim a As String, b As String, g As String, l As Long
a = Space$(128)
l = GetClassName(hWnd, a, 128)
g = Left(a, l)
l = SendMessage(hWnd, WM_GETTEXT, 128, ByVal a)
If g = "msctls_progress32" And Left(a, l) = "Progress4" Then
'* Ermittle Signalstärke
SignalStaerke = SendMessage(hWnd, PBM_Getpos, 0, 0)
End If
If g = "msctls_progress32" And Left(a, l) = "Progress3" Then
'* Ermittle Signalqualität
SignalQuali = SendMessage(hWnd, PBM_Getpos, 0, 0)
End If
EnumChildProc = 1
End Function
habe irgendwo hier mal nen Tut gesehen das es ermöglicht, aus Winamp Informationen zu lesen und weiterzuverarbeiten. Da ich gerne mit LCD Displays spiele habe ich mich gefragt, wie ich die Signalqualität und die Signalstärke von SkyDSL auf mein Display bekomme. Dieses wird vom Programm "DVBDATA" nur als Statusbalken dargestellt... Nach einiger Zeit des Grübelns kam ich auf folgende Idee:
Probierts mal aus
Die Variablen "Signalstaerke" und "Signalquali" enthalten die aktuellen Werte und können problemlos in eigene Projekte implementiert werden.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hWnd As Long, ByVal lpClassName As String, ByVal _
nMaxCount As Long) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" _
(ByVal lpString1 As String, ByVal lpString2 As String) _
As Long
Declare Function EnumChildWindows Lib "user32" (ByVal _
hWndParent As Long, ByVal lpEnumFunc As Long, ByVal _
lParam As Long) As Long
Const WM_GETTEXT = &HD
Const PBM_Getpos = 1032 '* Auslesen von Progressbar (SKyDSL)
Public WinampTitel As String
Public SignalStaerke As Long
Public SignalQuali As Long
Public hwndWinamp As Long, hwndSkyDSL As Long
Public Sub winamp()
Dim p_laenge As Long, p As String
hwndSkyDSL = FindWindow(vbNullString, "Datenapplikation") '* Name Fenster SKyDSL
If hwndSkyDSL = 0 Then SignalStaerke = 0
EnumChildWindows hwndSkyDSL, AddressOf EnumChildProc, ByVal 0&
hwndWinamp = FindWindow("Winamp v1.x", vbNullString)
p_laenge = GetWindowTextLength(hwndWinamp) + 1
p = Space(p_laenge)
p_laenge = GetWindowText(hwndWinamp, p, p_laenge)
'* Ungeschnittener Titel des WinampButtons *
WinampTitel = Left$(p$, p_laenge)
End Sub
Public Function EnumChildProc(ByVal hWnd As Long, ByVal lParam _
As Long) As Long
Dim a As String, b As String, g As String, l As Long
a = Space$(128)
l = GetClassName(hWnd, a, 128)
g = Left(a, l)
l = SendMessage(hWnd, WM_GETTEXT, 128, ByVal a)
If g = "msctls_progress32" And Left(a, l) = "Progress4" Then
'* Ermittle Signalstärke
SignalStaerke = SendMessage(hWnd, PBM_Getpos, 0, 0)
End If
If g = "msctls_progress32" And Left(a, l) = "Progress3" Then
'* Ermittle Signalqualität
SignalQuali = SendMessage(hWnd, PBM_Getpos, 0, 0)
End If
EnumChildProc = 1
End Function