用findwindow找到窗口句柄,如何用postmessage选择"确定"?

merryhoneymoon 2004-08-01 01:28:23
用findwindow找到窗口句柄(如下图),如何用postmessage选择"确定"?不要关闭,要点"确定"啊,

-----------------------
|选择框 |
-----------------------
| ------ ------ |
| |确定| |取消 | |
| ------ ------ |
-----------------------
...全文
406 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
merryhoneymoon 2004-08-01
  • 打赏
  • 举报
回复
我的按钮中有下划线啊,如何找到按钮的句柄???
merryhoneymoon 2004-08-01
  • 打赏
  • 举报
回复
to :gdami(糖米)
可是它怎么知道我单击哪一个按钮?
merryhoneymoon 2004-08-01
  • 打赏
  • 举报
回复
我要选择Outlook Express框框的"发送"按钮,可按钮有的's'有下划线,不成啊~~~~帮帮我~~

http://www.cerholding.com.cn/images/sendmail.jpg

程序如下:
=============
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private 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

Private Sub Timer1_Timer()'定时器,每1秒检测一次
frmHwnd = FindWindow(vbNullString, "Outlook Express")
If frmHwnd <> 0 Then
FindWindowEx frmHwnd, ByVal 0&, "Button", "发送(&s)"
End If
End Sub
=================
gdami 2004-08-01
  • 打赏
  • 举报
回复
写错了,不好意思。应该是

postmessage d,BM_CLICK, 0, 0
gdami 2004-08-01
  • 打赏
  • 举报
回复
Private Const BM_CLICK = &HF5 (表示单击消息)

'先用上面的方法找到确定按钮的句柄 d

postmessage d,0,BM_CLICK,0
HtSoft 2004-08-01
  • 打赏
  • 举报
回复
用楼上方法试试吧
online 2004-08-01
  • 打赏
  • 举报
回复
t = FindWindow("#32770", vbNullString)
d = FindWindowEx(t, ByVal 0&, "Button", "确定")
BlueBeer 2004-08-01
  • 打赏
  • 举报
回复
发送一个按下回车键的消息试试
merryhoneymoon 2004-08-01
  • 打赏
  • 举报
回复
另:postMessage 中的&10 、&12 是什么东东?有没有一个是选择确定的?
gdami 2004-08-01
  • 打赏
  • 举报
回复
FindWindowEx frmHwnd, ByVal 0&, "Button", vbnullstring

应该是第1个按钮,这么找就行了。

1,486

社区成员

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

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