vb 如何通过句柄获取其他信息

2024年12月01日 09:32
有1个网友回答
网友(1):

用API函数。
'获取目前选择的鼠标指针的句柄
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'返回包含了指定点的窗口的句柄
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
'取得一个窗体的标题文字
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
'为指定的窗口取得类名
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'从指定窗口的结构中取得信息
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
......