vb 有关sendmessage和postmessage的问题。

PublicDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString... Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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
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 PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_CHAR = &H102
Sub Macro1()
Dim hwnd, hwnd1 As Long
hwnd = FindWindow(vbNullString, "无标题 - 记事本")
hwnd1 = FindWindowEx(hwnd, 0, "edit", vbNullString)
SendMessage hwnd1, WM_CHAR, 65, 0
End Sub

在excel宏里打了这个代码,是想在记事本输出一个字符a的,但一运行,他就不行的输a直到记事本死掉,请问代码有什么问题,应该怎么样才能够只输出一个字符?

可以复制代码试一下,真的是这样,求大神解答为什么和解决方案!
展开
 我来答
阳光的雷咩咩
2016-05-30 · TA获得超过1.4万个赞
知道大有可为答主
回答量:2.3万
采纳率:66%
帮助的人:7835万
展开全部

Public   WM_CHAR = &H102这句运行不过啊。语法错误。

追问
你都没有打CONST.......
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式