'这个代码不对,还是不行
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowModuleFileName Lib "user32" (ByVal hWnd As Long, ByVal lpszFileName As String, ByVal cchFileNameMax As Long) As Long
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Dim hWnd As Long
If hWnd = FindWindow("ShImgVw:CPreviewWnd", vbNullString) > 0 Then
Dim sBuf$
sBuf = String$(261, 0)
GetWindowModuleFileName Me.hWnd, sBuf, 260
sBuf = Left$(sBuf, InStr(1, sBuf, vbNullChar) - 1)
Debug.Print sBuf
MsgBox sBuf
End If
End Sub