vb用sendmessage发送中文
已知要发的地方的句柄问第二个参数是用WM_char还是WM_settext还是别的什么?还有后面那俩参数怎么写?不要用复制哦,我要是找的到也不会来问。。不胜感激~wang...
已知要发的地方的句柄 问第二个参数是用WM_char 还是WM_settext还是别的什么?还有后面那俩参数怎么写?不要用复制哦,我要是找的到也不会来问。。不胜感激~
wangtk1982的答案为什么会有“dll调用约定错误”? 展开
wangtk1982的答案为什么会有“dll调用约定错误”? 展开
3个回答
展开全部
使用WM_SETTEXT 消息 WM_char 是单个字符
Public Const WM_SETTEXT = 12
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
窗体中
Dim i As Long
Dim s As String
s = "你要输入的文字"
i = SendMessage(hwnd, WM_SETTEXT, 0, ByVal s)
另 楼上两位说直接使用SetWindowText 这个函数如果是本地进程可以使用
如过是其他进程则只能使用SendMessage
这个是MSDN原话
If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.
To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText.
==============================================
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 Const WM_SETTEXT = 12
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
窗体中
Dim i As Long
Dim s As String
s = "你要输入的文字"
i = SendMessage(hwnd, WM_SETTEXT, 0, ByVal s)
另 楼上两位说直接使用SetWindowText 这个函数如果是本地进程可以使用
如过是其他进程则只能使用SendMessage
这个是MSDN原话
If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.
To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText.
==============================================
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
我把声明写错了 拉了点东西 呵呵
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
顶楼上,建议用SetWindowText API函数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询