列举正在运行的所有应用程序
来源:互联网 发布:淘宝首页怎么设计 编辑:程序博客网 时间:2024/04/27 13:23
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 SW_SHOW = 5
Public Const SW_RESTORE = 9
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 Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
Const MAX_PATH& = 260
Private Const SW_HIDE = 0
Private Const WM_CLOSE = &H10
Public HHWnd As Long
Public Function WhichWindowsCallBack(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
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
sWindowText = Space$(256)
lReturn = GetWindowText(hwnd, sWindowText, Len(sWindowText))
If lReturn Then
sWindowText = Left$(sWindowText, lReturn)
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
HHWnd = hwnd
WhichWindowsCallBack = True
End Function
Public Function fEnumWindows(lst As ListBox) As Long
With lst
.Clear
Call EnumWindows(AddressOf WhichWindowsCallBack, .hwnd)
fEnumWindows = .ListCount
End With
End Function
Private Sub Form_Load()
Call fEnumWindows(List1)
End Sub
- 列举正在运行的所有应用程序
- 列举当前运行的所有进程
- 列举 所有的 culture
- ubuntu查看所有正在运行的进程
- Linux 列出所有正在运行的进程
- 显示Linux所有正在运行的进程
- linux查看正在运行的所有端口
- 查看所有正在运行的进程
- android 获取正在运行的应用程序列表
- android 获取正在运行的应用程序列表 .
- android获取正在运行的应用程序
- android获取正在运行的应用程序
- c语言关闭正在运行的应用程序
- 列举当前所有的进程
- 检索所有正在运行的进程的列表
- 如何在Linux中查看所有正在运行的进程
- 如何在Linux中查看所有正在运行的进程
- 《在linux中显示所有正在运行的进程》
- Knowlege Management - Document Management System practice
- Ms Wu, good teacher!
- java新手,用Jbuilder X的问题
- BrowseFolder
- 四舍五入
- 列举正在运行的所有应用程序
- Tomcat4.01全攻略(转)
- Hibernate 入门
- GetInternetIP
- GetPID
- 关注Queue:Java 1.5 添加新的数据结构接口
- LockListViewHead
- 查看与更改NTFS文件夹权限
- 零碎代码