📄 frm1_1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "Form1"
ClientHeight = 4575
ClientLeft = 60
ClientTop = 345
ClientWidth = 5040
LinkTopic = "Form1"
ScaleHeight = 4575
ScaleWidth = 5040
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Load Text5"
Height = 315
Index = 1
Left = 480
TabIndex = 18
Top = 4080
Width = 1875
End
Begin VB.CommandButton Command1
Caption = "UnLoad Text5"
Enabled = 0 'False
Height = 315
Index = 0
Left = 2640
TabIndex = 17
Top = 4080
Width = 1875
End
Begin VB.TextBox Text1
Height = 315
Index = 4
Left = 2820
TabIndex = 4
Text = "Text1"
Top = 3300
Width = 1635
End
Begin VB.TextBox Text1
Height = 315
Index = 3
Left = 2820
TabIndex = 3
Text = "Text1"
Top = 2940
Width = 1635
End
Begin VB.TextBox Text1
Height = 315
Index = 2
Left = 720
TabIndex = 2
Text = "Text1"
Top = 3660
Width = 1635
End
Begin VB.TextBox Text1
Height = 315
Index = 1
Left = 720
TabIndex = 1
Text = "Text1"
Top = 3300
Width = 1635
End
Begin VB.TextBox Text1
Height = 315
Index = 0
Left = 720
TabIndex = 0
Text = "Text1"
Top = 2940
Width = 1635
End
Begin VB.Timer Timer1
Interval = 100
Left = 0
Top = 2580
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 5
Left = 3060
TabIndex = 16
Top = 2340
Width = 2055
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 4
Left = 3060
TabIndex = 15
Top = 1980
Width = 2055
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 3
Left = 3060
TabIndex = 14
Top = 1620
Width = 2055
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 2
Left = 3060
TabIndex = 13
Top = 1260
Width = 2055
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 1
Left = 3060
TabIndex = 12
Top = 840
Width = 2055
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "Label2"
Height = 255
Index = 0
Left = 3060
TabIndex = 11
Top = 360
Width = 2055
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "Form1的第一个子窗口句柄∶"
Height = 315
Index = 5
Left = 780
TabIndex = 10
Top = 2340
Width = 2535
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "桌面的句柄∶"
Height = 315
Index = 4
Left = 780
TabIndex = 9
Top = 1980
Width = 1995
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "当前指针句柄∶"
Height = 315
Index = 3
Left = 780
TabIndex = 8
Top = 1620
Width = 1995
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "前台线程活动窗口句柄∶"
Height = 315
Index = 2
Left = 780
TabIndex = 7
Top = 1260
Width = 1995
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "当前线程中补获鼠标输入的窗口柄∶"
Height = 495
Index = 1
Left = 780
TabIndex = 6
Top = 780
Width = 1995
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "顶级焦点窗口句柄∶"
Height = 315
Index = 0
Left = 780
TabIndex = 5
Top = 360
Width = 1995
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetWindow& Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long)
Private Declare Function GetActiveWindow& Lib "user32" ()
Private Declare Function GetFocus& Lib "user32" ()
Private Declare Function GetForegroundWindow& Lib "user32" ()
Private Declare Function GetCursor& Lib "user32" ()
Private Declare Function GetDesktopWindow& Lib "user32" ()
Private Const GW_CHILD& = 5
Private isLoadText5 As Integer 'Text1(5)是否装载
Private Sub Command1_Click(index As Integer)
Command1(0).Enabled = Not Command1(0).Enabled
Command1(1).Enabled = Not Command1(1).Enabled
isLoadText5 = index
If index = 1 Then
Load Text1(5)
Text1(5).Left = 2820
Text1(5).Top = 3660
Text1(5).Visible = True
Else
Unload Text1(5)
End If
End Sub
Private Sub Timer1_Timer()
Dim dl&
Dim i As Integer
Form1.Caption = "From1的句柄:" & Str(Form1.hWnd)
For i = 0 To 4 + isLoadText5
Text1(i).Text = "句柄∶" & Str(Text1(i).hWnd)
Next
dl& = GetActiveWindow()
Label2(0).Caption = dl
dl& = GetFocus
Label2(1).Caption = dl
dl& = GetForegroundWindow()
Label2(2).Caption = dl
dl& = GetCursor()
Label2(3).Caption = dl
dl& = GetDesktopWindow()
Label2(4).Caption = dl
dl& = GetWindow&(Form1.hWnd, GW_CHILD)
Label2(5).Caption = dl
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -