📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 6465
ClientLeft = 60
ClientTop = 420
ClientWidth = 8010
LinkTopic = "Form2"
Moveable = 0 'False
ScaleHeight = 6465
ScaleWidth = 8010
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox Text1
Height = 615
Left = 1890
TabIndex = 1
Text = "Form1"
Top = 3030
Width = 4215
End
Begin VB.CommandButton Command1
Caption = "Descobrir"
Height = 615
Left = 2850
TabIndex = 0
Top = 3780
Width = 2415
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "O titulo da Janela p/ achar o Hwnd da pr髉ia exemplo:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1515
Left = 60
TabIndex = 2
Top = 1710
Width = 7965
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, Text1.Text)
Debug.Print winHwnd
If winHwnd <> 0 Then
MsgBox winHwnd
Text1.Text = winHwnd
Form1.Text1.Text = winHwnd
Unload Me
Else
MsgBox Text1.Text + " n鉶 esta aberto.", vbInformation, "Usando PostMessage"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -