📄 password.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 345
ClientWidth = 5520
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 5520
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
AutoSize = -1 'True
DragMode = 1 'Automatic
Height = 540
Left = 2280
Picture = "password.frx":0000
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 12
Top = 240
Width = 540
End
Begin VB.CheckBox Check1
Caption = "总在最上面"
Height = 375
Left = 480
TabIndex = 11
Top = 360
Width = 1215
End
Begin VB.TextBox Text5
Height = 375
IMEMode = 3 'DISABLE
Left = 3720
PasswordChar = "*"
TabIndex = 10
Text = "123456"
Top = 1583
Width = 1455
End
Begin VB.TextBox Text4
Height = 375
Left = 1680
TabIndex = 9
Text = "123456"
Top = 2520
Width = 3495
End
Begin VB.TextBox Text3
Height = 375
Left = 1680
TabIndex = 8
Text = "ThunderTextBox"
Top = 2063
Width = 3495
End
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 7
Text = "3015668"
Top = 1583
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
Left = 1680
TabIndex = 6
Text = "323,365"
Top = 1155
Width = 1335
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "密码:"
Height = 180
Left = 3840
TabIndex = 5
Top = 1320
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "密码文本:"
Height = 180
Left = 240
TabIndex = 4
Top = 2640
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "目标窗口类型:"
Height = 180
Left = 240
TabIndex = 3
Top = 2160
Width = 1260
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "目标窗口句柄:"
Height = 180
Left = 240
TabIndex = 2
Top = 1680
Width = 1260
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "鼠标坐标:"
Height = 180
Left = 240
TabIndex = 1
Top = 1200
Width = 900
End
Begin VB.Label Label1
Caption = "拖动窗体中的图标到显示“*”的密码窗口"
Height = 735
Left = 3240
TabIndex = 0
Top = 240
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim IsDragging As Boolean
Private Sub SetOnTop(ByVal IsOnTop As Integer)
Dim rtn As Long
If IsOnTop = 1 Then '将窗口置于最上面
rtn = SetWindowPos(Form1.hwnd, -1, 0, 0, 0, 0, 3)
Else
rtn = SetWindowPos(Form1.hwnd, -2, 0, 0, 0, 0, 3)
End If
End Sub
Private Sub check1_click()
SetOnTop (Check1.Value)
End Sub
Private Sub Form_Load()
Check1.Value = 1
SetOnTop (Check1.Value)
IsDragging = False
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If IsDragging = True Then
Dim rtn As Long, curwnd As Long
Dim tempstr As String
Dim strlong As Long
Dim point As POINTAPI
point.x = x
point.y = y
'将客户坐标转化为屏幕坐标并显示在Text1文本框中
If ClientToScreen(Form1.hwnd, point) = 0 Then Exit Sub
Text1.Text = Str(point.x) + "," + Str(point.y)
'获得鼠标所在的窗口句柄并显示在Text2文本框中
curwnd = WindowFromPoint(point.x, point.y)
Text2.Text = Str(curwnd)
'获取该窗口的类型并显示在Text3文本框中
tempstr = Space(255)
strlong = Len(tempstr)
rtn = GetClassName(curwnd, tempstr, strlong)
If rtn = 0 Then Exit Sub
tempstr = Trim(tempstr)
Text3.Text = tempstr
'向该窗口发送一个WM_GETTEXT消息,以获得该窗口的文本
'并显示在Text4文本框中
tempstr = Space(255)
strlong = Len(tempstr)
rtn = SendMessage(curwnd, WM_GETTEXT, strlong, tempstr)
tempstr = Trim(tempstr)
Text4.Text = tempstr
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If IsDragging = True Then
Screen.MousePointer = vbDefault
IsDragging = False
'释放鼠标消息抓取
ReleaseCapture
End If
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If IsDragging = False Then
IsDragging = True
Screen.MousePointer = vbCustom
'将以后的鼠标输入消息都发送到本程序窗口
SetCapture (Form1.hwnd)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -