如何模拟点击迅雷的"下载确认对话框"?

chenyi7942 2010-05-04 10:26:53
想利用迅雷软件自动下载一些东西,我分析使用了迅雷提供的API,但老弹出下载确认对话框.

尝试在迅雷工具栏"配置"项中取消"操作确认",也不管用.

现在我考虑对迅雷的确认对话框发送消息,让迅雷关闭该对话框.
其间有一行获取不到子窗口句柄 EdithWnd = ::FindWindowEx(ParenthWnd,0, lpszClass_Submit, lpszName_Submit)

以下是我的代码,请界面高手帮我看看...

#include "stdafx.h"
#import "ThunderAgent.dll"
using namespace THUNDERAGENTLib;
DWORD WINAPI Fun1Proc(
LPVOID lpParameter // thread data
)
{
CString lpszParentClass = "#32770"; //整个窗口的类名
CString lpszParentWindow = "建立新的下载任务"; //窗口标题
CString lpszClass_Submit = "Button"; //需要查找的Button的类名
CString lpszName_Submit = "立即下载"; //需要查找的Button的标题
HWND ParenthWnd;
HWND EdithWnd;
int i = 0;
while (true)
{
Sleep(1000);
//查到窗体,得到整个窗体
ParenthWnd = ::FindWindow(lpszParentClass, lpszParentWindow);
//判断这个窗体是否有效
if (ParenthWnd)
{
//得到Button这个子窗体,并触发它的Click事件
EdithWnd = ::FindWindowEx(ParenthWnd,0, lpszClass_Submit, lpszName_Submit);
if (EdithWnd)
{
SendMessage(EdithWnd,0x00F5,0,0);
break;
}
}
if (i>5000000)
{
break;
}
i++;
}
return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = ::CoInitialize(0);
IAgent *pAgent = NULL;
hr = CoCreateInstance(__uuidof(Agent), NULL, CLSCTX_INPROC_SERVER, __uuidof(IAgent), (void**)&pAgent);
pAgent->AddTask("http://124.237.121.66:8089/wmapath/music/201003/yuanlai.wma",
"w01.mp3",
"D:\\win32\\Thunder",
"hhh",
"http://mp3.baidu.com",
1,
0,
-1);
HANDLE hThread1;
hThread1=::CreateThread(NULL,0,Fun1Proc,NULL,0,NULL);
CloseHandle(hThread1);
pAgent->CommitTasks();
Sleep(4000);
pAgent->Release();
::CoUninitialize();
return 0;
}



...全文
203 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangli820 2010-05-12
  • 打赏
  • 举报
回复
用 autoit 脚本语言,很容易的
向立天 2010-05-12
  • 打赏
  • 举报
回复
您好
我是本版版主
此帖已多日无人关注
请您及时结帖
如您认为问题没有解决可按无满意结帖处理
另外本版设置了疑难问题汇总帖
并已在版面置顶
相关规定其帖子中有说明
您可以根据规定提交您帖子的链接
如您目前不想结帖只需回帖说明
我们会删除此结帖通知

见此回复三日内无回应
我们将强制结帖
相关规定详见界面界面版关于版主结帖工作的具体办法
ziplj 2010-05-04
  • 打赏
  • 举报
回复
杯具
估计是想早早弄个星星 更好给"砖家"二字弄门面
尹成 2010-05-04
  • 打赏
  • 举报
回复
不懂这个
帮楼主顶到上面,以期更多高手帮楼主解决难题!
ziplj 2010-05-04
  • 打赏
  • 举报
回复
调试的时候可以使用最原始的 有效的 改写内存 + WinSpy来做 可以先测试逻辑正确性 而不拘泥于Windows API的使用
ziplj 2010-05-04
  • 打赏
  • 举报
回复
句柄错误一般都是FindWindowEx参数有问题造成的

LZ试试EnumWindow看看
chenyi7942 2010-05-04
  • 打赏
  • 举报
回复
看来这里没人会~~~

15,979

社区成员

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

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