VB.net 获取控件句柄
获取图片中,button1的句柄,代码如下:PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(B...
获取图片中,button1 的句柄,代码如下:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer 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 Integer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim hwnd0 As Long Dim hwnd11 As Long hwnd0 = FindWindow(vbNullString, "Form11") hwnd11 = FindWindowEx(hwnd0, 0, "Button", "Button1") TextBox2.Text = hwnd11 运行后,获取的句柄总是为0
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询