⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmClassFinder 
   Caption         =   "枚举系统中所有进程"
   ClientHeight    =   3744
   ClientLeft      =   4476
   ClientTop       =   2712
   ClientWidth     =   4860
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3744
   ScaleWidth      =   4860
   Begin VB.Timer tmrWinClass 
      Interval        =   100
      Left            =   4080
      Top             =   2880
   End
   Begin VB.ListBox lstOpenWindows 
      Height          =   1968
      Left            =   105
      Sorted          =   -1  'True
      TabIndex        =   3
      Top             =   120
      Width           =   4620
   End
   Begin VB.CommandButton cmdGetClass 
      Caption         =   "Get &Class"
      Height          =   315
      Left            =   3240
      TabIndex        =   1
      Top             =   1680
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.TextBox txtTitle 
      Height          =   285
      Left            =   120
      TabIndex        =   0
      Text            =   "Enter Window Title Here!"
      Top             =   840
      Width           =   4620
   End
   Begin VB.Label lblRight 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   228
      Left            =   120
      TabIndex        =   9
      Top             =   3360
      Width           =   1860
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblBottom 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   228
      Left            =   120
      TabIndex        =   8
      Top             =   2880
      Width           =   1860
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblLeft 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   228
      Left            =   120
      TabIndex        =   7
      Top             =   3120
      Width           =   1860
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblTop 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   228
      Left            =   120
      TabIndex        =   6
      Top             =   2640
      Width           =   1860
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblProcessID 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   228
      Left            =   120
      TabIndex        =   5
      Top             =   2400
      Width           =   1860
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblCount 
      BackColor       =   &H00C0C0C0&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   120
      TabIndex        =   4
      Top             =   2160
      Width           =   5628
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblClassName 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   252
      Left            =   120
      TabIndex        =   2
      Top             =   2160
      Width           =   5628
      WordWrap        =   -1  'True
   End
End
Attribute VB_Name = "frmClassFinder"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub cmdGetClass_Click()
'----------------------------------------------------------------------------------------------------------
'This sub locates information about a window when you select
'it from the list box.
'----------------------------------------------------------------------------------------------------------

Dim lngHand As Long
Dim strName As String * 255
Dim wndClass As wndClass
Dim lngProcID As Long
Dim rctTemp As RECT

'Locate the selected window and get its handle.
lngHand = FindWindow(vbNullString, txtTitle.Text)

'Using the handle obtained from FindWindow, get all class information
'about the selected window.
GetClassName lngHand, strName, Len(strName)

'If the name in the text box doesn't match a system window tell the user.
'Otherwise, get the process id and the window size info.
If Left$(strName, 1) = vbNullChar Then
     lblClassName.Caption = "Window Not Found!!!"
Else
     lblClassName.Caption = "Class Name: " & strName
     GetWindowThreadProcessId lngHand, lngProcID
     GetWindowRect lngHand, rctTemp
End If

'Load the labels with the info retrieved.
lblProcessID = "ProcessID: " & lngProcID
lblTop = "Top: " & rctTemp.Top
lblBottom = "Bottom: " & rctTemp.Bottom
lblLeft = "Left: " & rctTemp.Left
lblRight = "Right: " & rctTemp.Right

End Sub




Private Sub cmdActivate_Click()
'----------------------------------------------------------------------------------------------------------
'This sub activates the selected window.
'----------------------------------------------------------------------------------------------------------

'Variable to hold the handle to the window.
Dim lngHand As Long

'Find the window by class or title.
If Trim$(lblClassName.Caption) = "" Then
     lngHand = FindWindow(vbNullChar, Trim$(txtTitle.Text))
Else
     lngHand = FindWindow(Right$(lblClassName.Caption, (Len(lblClassName) - 12)), lstOpenWindows.Text)
End If

'Activate the selected window.
'Some windows are hidden so it will make the application the input app.
BringWindowToTop lngHand

End Sub



Private Sub cmdRefreshClass_Click()

Call cmdGetClass_Click

End Sub

Private Sub Form_Load()

'Make our app the top most window in the system.
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

'Highlight the text in txtTitle.
txtTitle.SelLength = Len(txtTitle.Text)

lblCount.Caption = GetOpenWindowNames & " open Windows."

End Sub


Private Sub lstOpenWindows_Click()

'Call the hidden cmdGetClass button.
txtTitle.Text = lstOpenWindows.Text
Call cmdGetClass_Click

End Sub


Private Sub tmrWinClass_Timer()

'Check every 100 ms for the current application int the
'system and load it's info to our form.
Dim lngHand As Long
Dim strName As String * 255

lngHand = GetForegroundWindow

GetWindowText lngHand, strName, Len(strName)

GetClassName lngHand, strName, Len(strName)

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -