请教窗体中两个相同控件的窗体类名识别
界面大概分布是如下:用户名:_____________________
密 码:_____________________
后面画横线的为输入框控件
这两个输入框控件的类名完全一样,而标题全部为空,要怎么样来分别找出这两个句柄
我的代码是:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
_______________________________________________________________________________________________
Private Sub Command1_Click()
Dim Hwnd&, HwdUse&, HwdPwd&
Hwnd = FindWindow("WindowsForms10.Window.8.app.0.218f99c", vbNullString) '以类名查找窗口句柄
If Hwnd <> 0 Then
HwdUse = FindWindowEx(Hwnd, 0, "WindowsForms10.EDIT.app.0.218f99c", vbNullString)
MsgBox HwdUse
HwdPwd = FindWindowEx(Hwnd, 0, "WindowsForms10.EDIT.app.0.218f99c", vbNullString)
MsgBox HwdPwd
End If
End Sub
一个窗体,中有两个输入框..两个输入框的类名及标题完全一样,要怎么样分别找到这两个输入框的句柄?
我要做的就是分别找到这两个输入框的句柄,然后用户名的输入框sendmessage用户名,密码的输入框sendmessage密码..
--------------------编程问答-------------------- 判断位置啊.
getwindowrect --------------------编程问答-------------------- 果断+1
补充:VB , API