这是用 hydra 说的方法实现的代码,不过,因为我选择了滚动标题栏,所以得到的不一定是全部的文件名。Nullsoft 的主页又更新了,所以那个现成的例子是找不到了,如果你需要的话我可以研究研究它,就是用 SendMessage 的那个方法。Option ExplicitPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Sub Command1_Click() Dim hWndWinAMP As Long Dim sName As String * 255 hWndWinAMP = FindWindow("Winamp v1.x", vbNullString)
If hWndWinAMP <> 0 Then Call GetWindowText(hWndWinAMP, sName, 255) IIf (InStr(1, sName, vbNullChar)) > 0, sName = Left(sName, InStr(1, sName, vbNullChar) - 1), sName = sName MsgBox sName End IfEnd Sub
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Sub Command1_Click() Dim hWndWinAMP As Long
Dim sName As String * 255 hWndWinAMP = FindWindow("Winamp v1.x", vbNullString)
If hWndWinAMP <> 0 Then
Call GetWindowText(hWndWinAMP, sName, 255)
IIf (InStr(1, sName, vbNullChar)) > 0, sName = Left(sName, InStr(1, sName, vbNullChar) - 1), sName = sName
MsgBox sName
End IfEnd Sub
可不可以用其他的api?关于资原的。