Click here to Skip to main content
16,015,393 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
hi
i want to detect currently opened swf file name here is my code
VB
Private Const GW_HWNDNEXT = 2
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount 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

Private Sub Form_Load()
   ListWins "*.swf*"
End Sub


VB
Sub ListWins(Optional Title = "*", Optional Class = "*")
   Dim hWndThis As Long
   hWndThis = FindWindow(vbNullString, vbNullString)
   While hWndThis
      Dim sTitle As String, sClass As String
      sTitle = Space$(255)
      sTitle = Left$(sTitle, GetWindowText(hWndThis, sTitle, Len(sTitle)))
      sClass = Space$(255)
      sClass = Left$(sClass, GetClassName(hWndThis, sClass, Len(sClass)))
      If sTitle Like Title And sClass Like Class Then
         Debug.Print sTitle, sClass
         List1.AddItem (sTitle)
      End If
      hWndThis = GetWindow(hWndThis, GW_HWNDNEXT)
   Wend
End Sub


this code is working fine to detect *.doc,*.xls files name but not working on *.swf files please help me
Posted
Updated 14-May-12 20:14pm
v2
Comments
Maciej Los 5-Sep-12 15:01pm    
The most swf files are opening in the web browsers. If you open it in a different program, you need to check for the instance of this program.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900