For Each myTask In Tasks
If InStr(myTask.Name, "Microsoft Word") Or InStr(myTask.Name, "Adobe InDesign") > 0 Then
' myTask.Activate
myTask.WindowState = wdWindowStateMinimize
End If
Next myTask
Можон ли свернуть все окна иначе?
Код:
А можно ли как-то без цикла это делать? Типа minimize All (или что-то в таком духе)?
Код:
Private Declare Function SendMessage Lib "user32.dll" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const WM_COMMAND As Long = &H111
'Процедура TurnAll - сворачивает все окна
Public Sub TurnAll()
SendMessage FindWindow("Shell_TrayWnd", vbNullString), WM_COMMAND, &H19F, 0
End Sub
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const WM_COMMAND As Long = &H111
'Процедура TurnAll - сворачивает все окна
Public Sub TurnAll()
SendMessage FindWindow("Shell_TrayWnd", vbNullString), WM_COMMAND, &H19F, 0
End Sub
Отлично. Спасибо!
Код:
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.MinimizeAll
Set objShell = Nothing
Set objShell = CreateObject("Shell.Application")
objShell.MinimizeAll
Set objShell = Nothing