求助 怎样用程序填写IE中的表格? 在线等

fata 2003-08-24 11:20:46
哪位大虾能教教偶 谢谢了 呵呵
...全文
33 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
fata 2003-08-25
  • 打赏
  • 举报
回复
晕 看8懂 不过还是谢谢
mahatma_cn 2003-08-24
  • 打赏
  • 举报
回复
我这里有一个,填写用户名和账号!
前几天做的,还没有完善,就是要优化一下,因为开始写代码时没有规划。
fata 2003-08-24
  • 打赏
  • 举报
回复
csdn的高手们呢? 谁能帮忙 谢谢了
fata 2003-08-24
  • 打赏
  • 举报
回复
没有人教吗? 晕
fata 2003-08-24
  • 打赏
  • 举报
回复
自己顶~~~~~
mahatma_cn 2003-08-24
  • 打赏
  • 举报
回复
晕,抢生意!
IThurricane 2003-08-24
  • 打赏
  • 举报
回复
请问什么是BHO?
prettywolf 2003-08-24
  • 打赏
  • 举报
回复
老大发话了,
我认为用BHO比较好。
masterz 2003-08-24
  • 打赏
  • 举报
回复
////////////////////////////////////////////////////////
//Fill input field in IE
//If it works, it is written by masterz,otherwise I don't
//know who writes it^_^
///////////////////////////////////////////////////////
#import <mshtml.tlb> // Internet Explorer 5
#import <shdocvw.dll>
#include "Shlwapi.h"
#pragma comment(lib,"Shlwapi.lib")
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
SHDocVw::IShellWindowsPtr m_spSHWinds;
if(m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows)) == S_OK)
{
IDispatchPtr spDisp;
long nCount = m_spSHWinds->GetCount();
for (long i = 0; i < nCount; i++)
{
_variant_t va(i, VT_I4);
spDisp = m_spSHWinds->Item(va);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
if (spBrowser != NULL)
{
IDispatchPtr spDisp;
if(spBrowser->get_Document(&spDisp) == S_OK && spDisp!= 0 )
{
MSHTML::IHTMLDocument2Ptr spHtmlDocument(spDisp);
MSHTML::IHTMLElementPtr spHtmlElement;
if(spHtmlDocument==NULL)
continue;
spHtmlDocument->get_body(&spHtmlElement);
if(spHtmlDocument==NULL)
continue;
HRESULT hr;
MSHTML::IHTMLElementCollection* pColl=NULL;
hr=spHtmlDocument->get_all(&pColl);
if(pColl!=NULL&&SUCCEEDED(hr))
{
long lcount = 0;
pColl->get_length(&lcount);
for(int i=0;i<lcount;i++)
{
_variant_t index;
index.vt=VT_I4;
index.intVal=i;
IDispatchPtr disp;
disp=pColl->item(index,index);
if(disp==NULL)
hr=E_FAIL;
else
{
MSHTML::IHTMLInputElementPtr pInput(disp);
if(pInput)
{
BSTR bstrtype;
pInput->get_type(&bstrtype);
printf(_bstr_t(bstrtype));
if(StrCmpW(bstrtype,L"text")==0)
{
pInput->put_value(_bstr_t("fill it"));
printf("fill a field\n");
}
SysFreeString(bstrtype);
}
}

}
pColl->Release();
}
}

}
}

}
else
{
printf("Shell Windows interface is not avilable\n");
}
CoUninitialize();
return 0;
}

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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