我从别的地方抄了一个过来,因为我还不会呢~~~所以现抄了一个
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2730
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2730
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text2
Height = 495
Left = 2400
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "显示"
Height = 495
Left = 1560
TabIndex = 1
Top = 1800
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 0
Top = 960
Width = 1215
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "显示密码"
Height = 180
Left = 2400
TabIndex = 4
Top = 720
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "输入密码"
Height = 180
Left = 960
TabIndex = 3
Top = 720
Width = 720
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalsePrivate Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
'取得窗口的标题文字或一个控件的内容
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
'调查窗口标题文字或控件的内容的长度
Private Sub Command1_Click()
Dim longth1 As Long
Dim aa As String * 10 'aa为text1中输入字符数
longth1 = GetWindowTextLength(Text1.hwnd) + 1
ch = GetWindowText(Text1.hwnd, aa, longth1)
Text2 = aa
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2730
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2730
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text2
Height = 495
Left = 2400
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "显示"
Height = 495
Left = 1560
TabIndex = 1
Top = 1800
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 0
Top = 960
Width = 1215
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "显示密码"
Height = 180
Left = 2400
TabIndex = 4
Top = 720
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "输入密码"
Height = 180
Left = 960
TabIndex = 3
Top = 720
Width = 720
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalsePrivate Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
'取得窗口的标题文字或一个控件的内容
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
'调查窗口标题文字或控件的内容的长度
Private Sub Command1_Click()
Dim longth1 As Long
Dim aa As String * 10 'aa为text1中输入字符数
longth1 = GetWindowTextLength(Text1.hwnd) + 1
ch = GetWindowText(Text1.hwnd, aa, longth1)
Text2 = aa
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货