enumerator.cls
来自「Windows超级黑客得到windows运行程序的信息,很经典的」· CLS 代码 · 共 955 行 · 第 1/3 页
CLS
955 行
For i = 1 To UBound(Winds2)
If Winds2(i).UseMe = True Then
' For some reason, there is a broken window in the system somewhere.
' Add it in underneath it's thread, and add a little bit to the display string.
Set NodesWork = Tree.Nodes.Add("_" & Format8(Winds2(i).Thread), tvwChild, "_" & Format8(Winds2(i).hWnd), Winds2(i).DisplayText & " The parental link to this window is broken.", WindPic)
NodesWork.Tag = Winds2(i).hWnd
Winds2(i).UseMe = False
' This might clear up some errors, so go back and retry it.
GoTo Doadds
End If
Next i
' Finally, make the whole list sorted
For Each NodesWork In Tree.Nodes
NodesWork.Sorted = True
Next NodesWork
' Put out the desktop selection
Tree.Nodes("_" & Format8(DesktopWind)).Expanded = True
Tree.Nodes("_" & Format8(DesktopWind)).Selected = True
Exit Sub
errhandler:
MsgBox "There has been an error parsing data inside the enumerator class. This may have been due to a window, thread, or complete program terminating, and changing records that were currently being processed. As a result, the list will not be loaded. Please try again.", vbCritical, "Critical Error"
Tree.Nodes.Clear
End Sub
Public Function ClassName(ByVal hWnd As Long) As String
ClassName = Space(500)
GetClassName hWnd, ClassName, Len(ClassName)
ClassName = FixApi(ClassName)
End Function
Public Function GetWindText(ByVal hWnd As Long) As String
GetWindText = Space(GetWindTextLength(hWnd) + 1)
GetWindowText hWnd, GetWindText, Len(GetWindText)
GetWindText = FixApi(GetWindText)
End Function
Public Function GetWindTextLength(ByVal hWnd As Long) As Long
GetWindTextLength = GetWindowTextLength(hWnd)
End Function
Private Sub Class_Initialize()
DestroyEnums
End Sub
Private Sub Class_Terminate()
DestroyEnums
End Sub
Private Function ParentIsIn(ByRef NodeCol As Nodes, ByVal ParentKey As String)
Dim Dummy As String
On Error Resume Next
Dummy = NodeCol(ParentKey).Key
If Err Then ParentIsIn = False Else ParentIsIn = True
End Function
Public Function Progenitor(ByVal hWnd As Long) As Long
Dim NewParent As Long
NewParent = hWnd
Do While NewParent
Progenitor = NewParent
NewParent = GetParent(Progenitor)
Loop
' The Progenitor variables now holds the progenitor... well, what did you expect?
End Function
Public Function IsEnabled(ByVal hWnd As Long) As Boolean
IsEnabled = IsWindowEnabled(hWnd)
End Function
Public Function IsVisible(ByVal hWnd As Long) As Boolean
IsVisible = IsWindowVisible(hWnd)
End Function
Public Function ThreadProcess(ByVal ThreadID As Long) As Long
' Call around to get hold of all of the threads.
Dim lSnapShot As Long
Dim CanEnum As Long
Dim uThread As THREADENTRY32
Dim ItemToAdd As String
ReDim ThreadsEnum(0 To 0) As ThreadIt
lSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPTHREAD, 0&)
If lSnapShot <> 0 Then
uThread.lSize = Len(uThread)
CanEnum = Thread32First(lSnapShot, uThread)
Do While CanEnum
If uThread.lThreadID = ThreadID Then ThreadProcess = uThread.lOwnerProcessID: Exit Do
CanEnum = Thread32Next(lSnapShot, uThread)
Loop
CloseHandle (lSnapShot)
End If
End Function
Public Function ThreadHung(ByVal ThreadID As Long) As Boolean
ThreadHung = IsHungThread(ThreadID)
End Function
Public Function MenuHandle(ByVal hWnd As Long) As Long
MenuHandle = GetMenu(hWnd)
If IsMenu(MenuHandle) = False Then MenuHandle = 0
End Function
Public Function SubMenu(ByVal hMenu As Long, ByVal Pos As Long) As Long
If IsMenu(hMenu) = False Then Exit Function
SubMenu = GetSubMenu(hMenu, Pos)
End Function
Public Function IsOnTop(ByVal hWnd As Long) As Boolean
Dim Styles As Long
Styles = GetWindowLong(hWnd, GWL_EXSTYLE)
If IsStyle(Styles, WS_EX_TOPMOST) = True Then IsOnTop = True
End Function
Public Function IsStyle(ByVal StyleLong As Long, ByVal StyleCheck As Long) As Boolean
If (StyleLong And StyleCheck) = StyleCheck Then IsStyle = True
End Function
Public Function StyleVal(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
StyleVal = GetWindowLong(hWnd, GWL_STYLE)
End If
End Function
Public Function ExtStyleVal(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
ExtStyleVal = GetWindowLong(hWnd, GWL_EXSTYLE)
End If
End Function
Public Function GetHandleInstance(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
GetHandleInstance = GetWindowLong(hWnd, GWL_HINSTANCE)
End If
End Function
Public Function GetUserData(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
GetUserData = GetWindowLong(hWnd, GWL_USERDATA)
End If
End Function
Public Function GetWndProc(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
GetWndProc = GetWindowLong(hWnd, GWL_WNDPROC)
End If
End Function
Public Function GetControlID(ByVal hWnd As Long) As Long
If IsValidWindow(hWnd) = True Then
GetControlID = GetWindowLong(hWnd, GWL_ID)
End If
End Function
Public Function SetParent(ByVal hWnd As Long, ByVal NewParent As Long) As Boolean
SetParent = CBool(SetParentA(hWnd, NewParent))
End Function
Public Function SetVisible(ByVal hWnd As Long, ByVal Visible As Boolean) As Boolean
If Visible = True Then
SetVisible = ShowWindow(hWnd, SW_SHOWNA)
Else
SetVisible = ShowWindow(hWnd, SW_HIDE)
End If
End Function
Public Function SetOntop(ByVal hWnd As Long, ByVal TopMost As Boolean) As Boolean
SetOntop = SetWindowPos(hWnd, IIf(TopMost, HWND_TOPMOST, HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Function
Public Function SetEnabled(ByVal hWnd As Long, ByVal Enabled As Boolean) As Boolean
SetEnabled = EnableWindow(hWnd, Enabled)
End Function
Public Sub ForeGround(ByVal hWnd As Long)
SetForegroundWindow hWnd
End Sub
Public Sub ActiveWind(ByVal hWnd As Long)
SetActiveWindow hWnd
End Sub
Public Sub FocusWind(ByVal hWnd As Long)
SetFocus hWnd
End Sub
Public Sub SetWindPos(ByVal hWnd As Long, ByVal Pos As Integer)
' Sets the Min, Max, or Normal attribute
Select Case Pos
Case Is = 0
' Normal
ShowWindow hWnd, SW_SHOWNORMAL
Case Is = 2
' Minimised
ShowWindow hWnd, SW_SHOWMINIMIZED
Case Is = 1
' Maximised
ShowWindow hWnd, SW_SHOWMAXIMIZED
End Select
End Sub
Public Sub TerminateWind(ByVal hWnd As Long)
PostMessage hWnd, modConst.WM_CLOSE, &O0, &O0
End Sub
Public Function WindPos(ByVal hWnd As Long) As EnumPos
If IsZoomed(hWnd) Then
WindPos = Maximized
ElseIf IsIconic(hWnd) Then
WindPos = Minimized
Else
WindPos = Normal
End If
End Function
Public Function Flash(ByVal hWnd As Long, ByVal Flasher As Boolean) As Long
Flash = FlashWindow(hWnd, Flasher)
End Function
Public Sub SetWinSizePos(ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal Width As Long, ByVal Height As Long)
MoveWindow hWnd, X, Y, Width, Height, True
End Sub
Public Function GetRelWindow(ByVal hWnd As Long, ByVal RelType As Relations) As Long
GetRelWindow = GetWindow(hWnd, RelType)
End Function
Public Sub BringToTop(ByVal hWnd As Long)
BringWindowToTop hWnd
End Sub
Public Sub SendToBottom(ByVal hWnd As Long)
SetWindowPos hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Public Function GetDC(ByVal hWnd As Long) As Long
GetDC = GetWindowDC(hWnd)
End Function
Public Sub RelDC(ByVal hWnd As Long, ByVal hdc As Long)
ReleaseDC hWnd, hdc
End Sub
Public Sub SetWindText(ByVal hWnd As Long, ByVal Text As String)
SetWindowText hWnd, Text
End Sub
Public Sub ForceRedraw(ByVal hWnd As Long)
Call InvalidateRect(hWnd, CLng(0), 1)
Call UpdateWindow(hWnd)
End Sub
Public Function GetBigIconH(ByVal hWnd As Long) As Long
GetBigIconH = SendMessage(hWnd, WM_GETICON, 1, 0) ' 1 = ICON_BIG
End Function
Public Function GetSmallIconH(ByVal hWnd As Long) As Long
GetSmallIconH = SendMessage(hWnd, WM_GETICON, 0, 0) ' 0 = ICON_SMALL
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' From here down, the functions are to do with class information '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function GetClassExtraBytes(ByVal hWnd As Long) As Long
GetClassExtraBytes = GetClassLong(hWnd, GCL_CBCLSEXTRA)
End Function
Public Function GetClassExtraWndBytes(ByVal hWnd As Long) As Long
GetClassExtraWndBytes = GetClassLong(hWnd, GCL_CBWNDEXTRA)
End Function
Public Function GetClasshBackgroundBrush(ByVal hWnd As Long) As Long
GetClasshBackgroundBrush = GetClassLong(hWnd, GCL_HBRBACKGROUND)
End Function
Public Function GetClassHCursor(ByVal hWnd As Long) As Long
GetClassHCursor = GetClassLong(hWnd, GCL_HCURSOR)
End Function
Public Function GetClassHIcon(ByVal hWnd As Long) As Long
GetClassHIcon = GetClassLong(hWnd, GCL_HICON)
End Function
Public Function GetClasshSmallIcon(ByVal hWnd As Long) As Long
GetClasshSmallIcon = GetClassLong(hWnd, GCL_WNDPROC)
End Function
Public Function GetClassHModule(ByVal hWnd As Long) As Long
GetClassHModule = GetClassLong(hWnd, GCL_HMODULE)
End Function
Public Function GetClassMenuName(ByVal hWnd As Long) As Long
GetClassMenuName = GetClassLong(hWnd, GCL_MENUNAME)
End Function
Public Function GetClassStyle(ByVal hWnd As Long) As Long
GetClassStyle = GetClassLong(hWnd, GCL_STYLE)
End Function
Public Function GetClassWndProc(ByVal hWnd As Long) As Long
GetClassWndProc = GetClassLong(hWnd, GCL_WNDPROC)
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?