为什么传不过去数值?

nanyankaoran 2008-03-15 08:46:05
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
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 Command2_Click()

Dim s As String
s = Text1.Text
SendMessage Me.hwnd, WM_SETTEXT, 0, s

End Sub
'为什么我一按按钮,form1.caption变成了空的,
'如果把TEXT1.TEXT=你好,怎能样用这个API 把它传到那?
'我知道貌岸然S这里要用地址传,但我不会,如何才能实现?
...全文
95 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zzyong00 2008-03-16
好想知道你个人的高招啊
只是不知我的哪个为什么行啊,难道同样的电脑,差距就这么大吗?
回复
nanyankaoran 2008-03-16
我终于用我个人的办法解决了
回复
nanyankaoran 2008-03-16
我试了上面两位大侠的招法,但还是那样,其他人的高招呢?
回复
zzyong00 2008-03-15
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
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 s As String
s = StrConv(Text1.Text, vbFromUnicode)
SendMessage Me.hwnd, WM_SETTEXT, 0, ByVal StrPtr(s)

End Sub
回复
lyserver 2008-03-15
将SendMessage Me.hWnd,WM_SETTEXT,0,s改成
SendMessage Me.hWnd,WM_SETTEXT,0,byval s就可以了.
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7490

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2008-03-15 08:46
社区公告
暂无公告