获取HTML中的控件的信息的问题。(50分)

  • 主题发起人 beckjiang
  • 开始时间
B

beckjiang

Unregistered / Unconfirmed
GUEST, unregistred user!
IHTMLDocument2* pDoc = NULL;
IHTMLElementCollection* pAllElem = NULL;
IHTMLElement* pElem = NULL;
IHTMLTextAreaElement* pTextArea=NULL;
IHTMLSelectElement* pSelect=NULL;
IHTMLInputElement* pInput=NULL;
BOOL Result=TRUE;
(void *)pDoc = CppWebBrowser1->Document;
if(pDoc!=NULL)
{
pDoc->get_all(&pAllElem);
if(pAllElem!=NULL)
{
long EleCount;
pAllElem->get_length(&EleCount);
VARIANT vEleName;
BSTR bValue;
for(int i=0;
i<=EleCount;i++)
{
vEleName.vt = VT_I4;
vEleName.lVal=i;
if(pAllElem->item(vEleName,vEleName,(LPDISPATCH*)&pElem)==S_OK)
{
if(pElem!=NULL)
{
pElem->QueryInterface(&pInput);
if(pInput!=NULL)
{
pInput->get_name(&bValue);
Memo2->Lines->Add(bValue);
pInput->get_value(&bValue);
Memo2->Lines->Add(bValue);
pInput->Release();
}//if(pInput!=NULL)
pElem->QueryInterface(&pTextArea);
if(pTextArea!=NULL)
{
pTextArea->get_name(&bValue);
Memo2->Lines->Add(bValue);
pTextArea->get_value(&bValue);
Memo2->Lines->Add(bValue);
pTextArea->Release();
}//if(pTextArea!=NULL)
pElem->QueryInterface(&pSelect);
if(pSelect!=NULL)
{
pSelect->get_name(&bValue);
Memo2->Lines->Add(bValue);
pSelect->get_value(&bValue);
Memo2->Lines->Add(bValue);
pSelect->Release();
}//if(pSelect!=NULL)
pElem->Release();
}//if(pElem!=NULL)
}//pAllElem->item(
}//for
pAllElem->Release();
}//if(pAllElem!=NULL)
pDoc->Release();
}//if(pDoc!=NULL)
这段程序只能获取INPUT框的一些信息,却不能获取TABLE框的任何信息,请问,我应该怎么操作,我的最终目的是为了获取一个TABLE框中的TD的一些信息。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
562
import
I
顶部