Может такой вопрос кто и задавал, но потрашить весь форум мне не хочется. Как можно отобразить запущенные приложения и как ими управлять? Сворачивать, закрывать и т.п.? А то сделал прогу, аналог Explorer'а (которому принадлежит ненависная кнопка пуск) все есть, меню, окна, куча оформления и доп. функций, а как это сделать не знаю. Даже самому обидно, мелочь, а какая важная.
Public Function fEnumWindows(lst As ListBox) As Long
'
' Clear list, then fill it with the running
' tasks. Return the number of tasks.
'
' The EnumWindows function enumerates all top-level windows
' on the screen by passing the handle of each window, in turn,
' to an application-defined callback function. EnumWindows
' continues until the last top-level window is enumerated or
' the callback function returns FALSE.
'
With lst
.Clear
Call EnumWindows(AddressOf fEnumWindowsCallBack, .hWnd)
fEnumWindows = .ListCount
End With
End Function
Private Function fEnumWindowsCallBack(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim lReturn As Long
Dim lExStyle As Long
Dim bNoOwner As Boolean
Dim sWindowText As String
'
' This callback function is called by Windows (from
' the EnumWindows API call) for EVERY window that exists.
' It populates the listbox with a list of windows that we
' are interested in.
'
' Windows to display are those that:
' - are not this app's
' - are visible
' - do not have a parent
' - have no owner and are not Tool windows OR
' have an owner and are App windows
'
If hWnd <> frmTaskbar.hWnd Then
If IsWindowVisible(hWnd) Then
If GetParent(hWnd) = 0 Then
bNoOwner = (GetWindow(hWnd, GW_OWNER) = 0)
lExStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
If (((lExStyle And WS_EX_TOOLWINDOW) = 0) And bNoOwner) Or _
 (lExStyle And WS_EX_APPWINDOW) And Not bNoOwner) Then
'
' Get the window's caption.
'
sWindowText = Space$(256)
lReturn = GetWindowText(hWnd, sWindowText, Len(sWindowText))
If lReturn Then
'
' Add it to our list.
'
sWindowText = Left$(sWindowText, lReturn) & "*Softshell_Logi*" & hWnd
lReturn = SendMessage(lParam, LB_ADDSTRING, 0, ByVal sWindowText)
Call SendMessage(lParam, LB_SETITEMDATA, lReturn, ByVal hWnd)
End If
End If
End If
End If
End If
fEnumWindowsCallBack = True
End Function
ну конечно надо чуть чуть повникать было... (или повтыкать ))))))))) лана, нати готовое!
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public 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 Const GW_OWNER = 4
Public Const GWL_HWNDPARENT = (-8)
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TOOLWINDOW = &H80
Public Const WS_EX_APPWINDOW = &H40000
Public Const LB_ADDSTRING = &H180
Public Const LB_SETITEMDATA = &H19A
Public Function fEnumWindows(lst As ListBox) As Long
'
' Clear list, then fill it with the running
' tasks. Return the number of tasks.
'
' The EnumWindows function enumerates all top-level windows
' on the screen by passing the handle of each window, in turn,
' to an application-defined callback function. EnumWindows
' continues until the last top-level window is enumerated or
' the callback function returns FALSE.
'
With lst
.Clear
Call EnumWindows(AddressOf fEnumWindowsCallBack, .hWnd)
fEnumWindows = .ListCount
End With
End Function
Private Function fEnumWindowsCallBack(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim lReturn As Long
Dim lExStyle As Long
Dim bNoOwner As Boolean
Dim sWindowText As String
'
' This callback function is called by Windows (from
' the EnumWindows API call) for EVERY window that exists.
' It populates the listbox with a list of windows that we
' are interested in.
'
' Windows to display are those that:
' - are not this app's
' - are visible
' - do not have a parent
' - have no owner and are not Tool windows OR
' have an owner and are App windows
'
If hWnd <> Form1.hWnd Then
If IsWindowVisible(hWnd) Then
If GetParent(hWnd) = 0 Then
bNoOwner = (GetWindow(hWnd, GW_OWNER) = 0)
lExStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
If (((lExStyle And WS_EX_TOOLWINDOW) = 0) And bNoOwner) Or _
 (lExStyle And WS_EX_APPWINDOW) And Not bNoOwner) Then
'
' Get the window's caption.
'
sWindowText = Space$(256)
lReturn = GetWindowText(hWnd, sWindowText, Len(sWindowText))
If lReturn Then
'
' Add it to our list.
'
sWindowText = Left$(sWindowText, lReturn) & " " & hWnd
lReturn = SendMessage(lParam, LB_ADDSTRING, 0, ByVal sWindowText)
Call SendMessage(lParam, LB_SETITEMDATA, lReturn, ByVal hWnd)
End If
End If
End If
End If
End If
fEnumWindowsCallBack = True
End Function
на будущее, в ВБ есть встроенный API Text Viewer, загружаешь в него текстовую базу, потом в поиск тыкаешь ту функцию которая тебе нужна, он он находит полное обращение к этой, копирешь, пестиш в вб, и всё ок