关于窗口句柄——大家请关注?

changxds 2003-10-20 11:08:14
怎么才能在指定窗口(已知句柄)的指定输入框中输入指定的内容,然后再单击“确定”按钮,最好附源码说明!谢谢!
...全文
46 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
changxds 2003-10-24
  • 打赏
  • 举报
回复
深情渴望中……
aha99 2003-10-23
  • 打赏
  • 举报
回复
SendMessage Text1.hwnd, WM_SETTEXT, 0&, ByVal "test"
我在xp下用的,没问题呀。。。。
wzucdos 2003-10-23
  • 打赏
  • 举报
回复
rainstormmaster(rainstormmaster)大虾呢?
wzucdos 2003-10-23
  • 打赏
  • 举报
回复
goodname008 在吗?
changxds 2003-10-23
  • 打赏
  • 举报
回复
大虾到哪儿去了?
fzn0621 2003-10-23
  • 打赏
  • 举报
回复
up
flc 2003-10-23
  • 打赏
  • 举报
回复
XUEXI学习
changxds 2003-10-23
  • 打赏
  • 举报
回复
aha99(学习):
不是Text1.hwnd,而是在其他应用程序中的文本框
changxds 2003-10-22
  • 打赏
  • 举报
回复
用SetWindowText也不行,再次郁闷!
daviddivad 2003-10-22
  • 打赏
  • 举报
回复
to rainstormmaster(rainstormmaster)

private type POINT
x as long
y as long
end type

private type NMHDR
hwndFrom as long
idFrom as long
code as long
end type

private type NMCLICK
hdr as NMHDR
dwItemSpec as long
dwItemData as long
pt as POINT
dwHitInfo as long
end type
rainstormmaster 2003-10-21
  • 打赏
  • 举报
回复
用SetWindowText试试:

Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Private Sub Command1_Click()
SetWindowText Text1.Text, "1234abc"
End Sub
changxds 2003-10-21
  • 打赏
  • 举报
回复
类名:TEdit
rainstormmaster 2003-10-21
  • 打赏
  • 举报
回复
参考:
http://www.china-askpro.com/msg33/qa99.shtml
rainstormmaster 2003-10-21
  • 打赏
  • 举报
回复
函数的用法没有问题,用spy查看一下文本框的类名,贴上来,我继续说
changxds 2003-10-21
  • 打赏
  • 举报
回复
bwnd是正确的值(已经用spy查看结果)
怎么会事呢?郁闷!
rainstormmaster 2003-10-21
  • 打赏
  • 举报
回复
文本框的标题???

bwnd = FindWindowEx(twnd, ByVal 0&, "tedit", vbNullString)
返回值是需要的值吗(用spy查看一下结果)

changxds 2003-10-21
  • 打赏
  • 举报
回复
"tedit"文本框的标题被改为12345,但我想改变的是文本框的文字内容??呜呜!
changxds 2003-10-21
  • 打赏
  • 举报
回复
twnd = FindWindow("tform2", "身份验证")
bwnd = FindWindowEx(twnd, ByVal 0&, "tedit", vbNullString)
Call SendMessage(bwnd, wm_settext, 0, ByVal "12345")

请问大虾:我以上的语句运行后为什么"tedit"框中却没有任何内容,到底错在哪儿?
changxds 2003-10-21
  • 打赏
  • 举报
回复
twnd = FindWindow("tform2", "身份验证")
bwnd = FindWindowEx(twnd, ByVal 0&, "tedit", vbNullString)
Call SendMessage(bwnd, wm_settext, 255, ByVal "12345")
请问大虾:我以上的语句运行后为什么"tedit"框中却没有任何内容,到底错在哪儿?
rainstormmaster 2003-10-21
  • 打赏
  • 举报
回复
to daviddivad(你真行,居然比我还快! Scorpio) :
用SendMessage 发送WM_COMMAND消息时,需要用到type nmclick,能提供一下声明吗?

加载更多回复(5)

1,485

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧