Allora raga, ci sono riuscito, la soluzione nn è una delle + eleganti ma funziona cmq. posto il codice così se qualcuno ha qualche idea per migliorarlo me lo faccia sapere.
codice:'Nella FORM Private Sub Timer1_Timer() EnumWindows AddressOf EnumWindowsProc, ByVal 0& For Index2 = 0 To List1.ListCount - 1 EnumChildWindows List1.List(Index2), AddressOf EnumChildProc, ByVal 0& Next Index2 End Sub 'NEL MODULO Const TB_DELETEBUTTON = 1046 Const TB_BUTTONCOUNT = 1048 Const TB_GETBUTTONTEXT = 1069 Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindowTextLength Lib "user32"_ Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long Declare Function EnumChildWindows Lib "user32" _ (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Declare Function EnumWindows Lib "user32"_ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean 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 SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Function EnumWindowsProc(ByVal hWnd As Long, ByVal lParam As Long) As Boolean Dim sSave As String, ret As Long ret = GetWindowTextLength(hWnd) sSave = Space(ret) GetWindowText hWnd, sSave, ret + 1 pippo = InStr(1, sSave, "pippo", vbTextCompare) 'Nel titolo di ogni finestra di explorer compare pippo, 'in caso contrario bisognerebbe cercare le 'finestre di classe IEFrame se nn ricordo male If pippo <> 0 Then Form1.List1.AddItem Str$(hWnd) EnumWindowsProc = True End Function Public Function EnumChildProc(ByVal hWnd As Long, ByVal lParam As Long) As Long Dim sSave As String Dim ret As Byte Dim NumButton As Byte sSave = Space$(256) ret = GetClassName(hWnd, sSave, 256) sSave = Left$(sSave, ret) If InStr(1, sSave, "ToolbarWindow32", vbTextCompare) <> 0 Then NumButton = SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0) If NumButton <= 6 And NumButton >= 5 Then SendMessage hWnd, TB_DELETEBUTTON, 2, 2 SendMessage hWnd, TB_DELETEBUTTON, 3, 3 End If End If EnumChildProc = 1 End Function


Rispondi quotando