vb的sendkeys用法
比如对当前已打开的窗口,用sendkey输入一段文字怎么输?比如我打开了一个text文档运行VB程序,command1Click就让文本文档里出现“abcde”...
比如对当前已打开的窗口,用sendkey输入一段文字
怎么输?
比如我打开了一个text文档
运行VB程序,command1 Click 就让文本文档里出现“abcde” 展开
怎么输?
比如我打开了一个text文档
运行VB程序,command1 Click 就让文本文档里出现“abcde” 展开
2个回答
展开全部
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
Const EM_REPLACESEL = &HC2
方法一:
Private Sub Command1_Click()
Text1.Text = ""
Text1.SetFocus
SendKeys "abcde"
End Sub
方法二:
Private Sub Command1_Click()
SendMessage Text1.hwnd, EM_REPLACESEL, 0, ByVal "abcde"
End Sub
Const EM_REPLACESEL = &HC2
方法一:
Private Sub Command1_Click()
Text1.Text = ""
Text1.SetFocus
SendKeys "abcde"
End Sub
方法二:
Private Sub Command1_Click()
SendMessage Text1.hwnd, EM_REPLACESEL, 0, ByVal "abcde"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询