API函数获取记事本信息的问题
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) 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 a As Long
Dim b As Long
Dim d As Long
Dim c As String
a = FindWindow(vbNullString, "无标题 - 记事本")
d = FindWindowEx(a, 0, "Edit", vbNullString)
c = Space(255)
GetWindowText d, c, 255
Text1.Text = c
End Sub
为什么text1获取不了记事本的内容,记事本是打开着的。哪位老师能指教?