| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 552 人关注过本帖
标题:vb 控制外部程序问题
只看楼主 加入收藏
Muxeel_unite
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-11-14
收藏
 问题点数:0 回复次数:0 
vb 控制外部程序问题
我想用vb的按下按钮  想按下qq的"立即安装"按钮  我已经获得“立即安装”按钮的句柄和ID  接下来怎么做?
程序代码:
[codePrivate Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) 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 htxt0 As Long, htxt1 As Long, htxt2 As Long, htxt3 As Long, idd As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
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 Const BN_CLICKED = 0
Private Const WM_COMMAND = &H111

Private Sub Command1_Click()
lngtemp = WinExec("G:\QQ6.4_6.4.12593.0.exe", 1) '返回值>32表示打开成功
End Sub

Private Sub Command2_Click()
htxt0 = FindWindowEx(0, 0, "#32770", "腾讯QQ安装向导")
Print htxt0
htxt1 = FindWindowEx(htxt0, 0, "#32770", "")
Print htxt1
htxt2 = FindWindowEx(htxt0, htxt1, "#32770", "")
Print htxt2
htxt3 = FindWindowEx(htxt2, 0, "Button", "立即安装")
Print htxt3
End Sub

Private Sub Command3_Click()
GetWindowThreadProcessId htxt3, idd
Print idd
End Sub

Private Sub Command4_Click()
SendMessage htxt2, BN_CLICKED, idd, htxt3
End Sub
图片附件: 游客没有浏览图片的权限,请 登录注册
]
[/code]
2014-11-14 23:21
快速回复:vb 控制外部程序问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022605 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved