怎么用代码实现点击网页下的某一个按钮

如何用代码实现点击网页上的某一个按钮
CSDN发个图真麻烦。。有几个问题想请教大家
1:网页上有一个EDIT编辑框,如何把一个字符串赋值给它,用findwindow么?但不太会用SPY。。囧
2:如何用代码实现点击网页上的一个按钮。
其实是这样滴,我想做一个批量注册账号的程序,除了用户名和验证码,其他都可以一样,我只需要在自己的对话框中添加一个EDIT用来输入验证码,一个按钮用来完成注册。求帮忙。。谢谢
------解决方案--------------------
网页上很少用Windows控件 ,你不要打算这样搞,行不通的
------解决方案--------------------
void COpnPageDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
if(m_pHtmlView)
{
IHTMLDocument2 *pIHTMLDoc=(IHTMLDocument2*)m_pHtmlView->GetHtmlDocument();
if(pIHTMLDoc)
{
EnumFrame(pIHTMLDoc);
CString Str;
CComQIPtr< IHTMLElementCollection > spAllElementCollection;
HRESULT hr = pIHTMLDoc->get_all( &spAllElementCollection ); //
long nAllCount=0;
hr=spAllElementCollection->get_length(&nAllCount);
Str.Format(TEXT("all: %d"),nAllCount);
OutputDebugString(Str);
for(long i = 0 ;  i < nAllCount ;  i++)
{
IDispatch *pDisp = NULL; //取得第 i 个Link
spAllElementCollection->item( CComVariant(i) , CComVariant() , &pDisp);
if ( pDisp == NULL ) continue;

CComQIPtr< IHTMLElement > spElement = pDisp;
pDisp->Release();
if(!spElement) continue;
CComBSTR bstrSrc;
spElement->get_tagName(&bstrSrc);
CString tStr;
tStr+=bstrSrc.m_str;
tStr+=" ";
/*spElement->get_outerText(&bstrSrc);
tStr+=bstrSrc.m_str;
tStr+=" ";*/

if(_tcsicmp(bstrSrc.m_str,TEXT("A"))==0 
------解决方案--------------------
 _tcsicmp(bstrSrc.m_str,TEXT("LINK"))==0)
{
spElement->get_outerText(&bstrSrc);
tStr+=bstrSrc.m_str;
tStr+=" ";
/*if(_tcsstr(bstrSrc.m_str,TEXT("同意以下协议"))!=NULL)
{
    spElement->click();//这里就是按钮提交
}*/
OutputDebugString(tStr);
}

}
}
}
}

HRESULT COpnPageDlg::EnumFrame(IHTMLDocument2 *pHtmlDoc)
{
if(pHtmlDoc==NULL)
{
return -1;
}
CComPtr< IHTMLFramesCollection2 > spFramesCollection2;
pHtmlDoc->get_frames( &spFramesCollection2 ); //取得框架frame的集合
long nFrameCount=0; //取得子框架个数
HRESULT hr = spFramesCollection2->get_length( &nFrameCount );
if(hr>=0 && nFrameCount>0)
{
CString Str;
Str.Format(TEXT("frames:%d"),nFrameCount);
OutputDebugString(Str);
for(int i=0;i<nFrameCount;i++)
{
CComVariant vDispWin2; //取得子框架的自动化接口
hr=spFramesCollection2->item(&CComVariant(i) , &vDispWin2);

//取得子框架的 IHTMLWindow2 接口
CComQIPtr< IHTMLWindow2 > spWin2 = vDispWin2.pdispVal;
if( !spWin2 ) continue;

CComPtr < IHTMLDocument2 > spDoc2;
spWin2->get_document( &spDoc2 ); //取得子框架的 IHTMLDocument2 接口
EnumFrame(spDoc2);


CComQIPtr< IHTMLElementCollection > spAllElementCollection;
hr = pHtmlDoc->get_links( &spAllElementCollection ); //
long nAllCount=0;
hr=spAllElementCollection->get_length(&nAllCount);