Private Const WM_SETTEXT = &HC
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim w As Long
w = SendMessage(Text1.hwnd, WM_SETTEXT, ByVal 0&, ByVal "王小明")
If w = 0 Then
MsgBox "失败"
Else
MsgBox "成功"
End If
End Sub