Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Sub Command1_Click()
Dim lR As Long
Dim strT As String * 127
'打开记事本程序,要空的
lR = FindWindow(vbNullString, "无标题 - 记事本")
MsgBox lR
GetWindowText lR, strT, 127
MsgBox Replace(strT, Chr(0), "")
End Sub