|
我在模块里定义了:
Public Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, _
ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" _
Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_OWNER = 4
在窗体的代码如下:
Sub FindTitle()
'查找桌面上的所有窗口标题
Dim currwnd As Long, length As Long, i As Integer
Dim listitem As String
currwnd = GetWindow(hwnd, GW_HWNDFIRST)
While currwnd <> 0
length = GetWindowTextLength(currwnd)
listitem = Space(length + 1)
length = GetWindowText(currwnd, listitem, length + 1)
If length > 0 Then
MsgBox listitem
End If
currwnd = GetWindow(currwnd, GW_HWNDNEXT)
Wend
End Sub
Private Sub Command0_Click()
FindTitle
End Sub
运行代码后无错误,但只能获取Access 内部窗体的标题.
有没有办法突破Access这个主窗体的限制,去获取外部程序的窗体标题
请各位高手给点宝贵意见.谢谢 谢谢 谢谢大家
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|