Private Sub Command1_Click()
Dim s As String
Dim FT_hWnd As Long
Dim ID_Control_hWnd As Long
s = "你最近好不好我很想你,你知道吗?"
FT_hWnd = FindWindow(vbNullString, "1.txt - 记事本")
If FT_hWnd = 0 Then
MsgBox "False", vbInformation, "Title"
End
End If
ID_Control_hWnd = GetDlgItem(FT_hWnd, &HF)
SendMessage ID_Control_hWnd, WM_SETTEXT, 0, ByVal s
End Sub
上面这段程序可以正常运行 在1.txt理会出现“你最近好不好我很想你,你知道吗?"这段话,可是我加上一个回车键按下动作之后就没用了? 请问是怎么回事?下面就有问题了:
Private Sub Command1_Click()
Dim s As String
Dim FT_hWnd As Long
Dim ID_Control_hWnd As Long
's = "你最近好不好我很想你,你知道吗?"
FT_hWnd = FindWindow(vbNullString, "1.txt - 记事本")
If FT_hWnd = 0 Then
MsgBox "False", vbInformation, "Title"
End
End If
ID_Control_hWnd = GetDlgItem(FT_hWnd, &HF)
SendMessage ID_Control_hWnd, VW_keydown, 13, 13
End Sub
这样后就什么反应都没有了?? 以下是模块里的东西
Public Const WM_SETTEXT = &HC
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
请各位大侠赐教!!!!!!!