bool CMoveArmEle::choose airarm(int iAirNum)
{
USES _ CONVERSION
bool bChooseArmHead = false
If( 7 == m_iType )//開分支基地不需要指揮官。
bChooseArmHead = true
IDispatch * pDisp = m _ pHtmlView-& gt;GetForm(" f 1 ");
if( NULL == pDisp)
返回false
CComQIPtr & ltIHTMLFormElement & gtspFormElement = pDisp
pDisp-& gt;發布();
long nElemCount = 0;//獲取表單中的字段數。
HRESULT HR = spFormElement-& gt;獲取長度(& ampnelem count);
如果(失敗(小時) )
返回false
for(長j = 0;j & ltnElemCountj++)
{
CComDispatchDriver spInputElement;//獲取第j個表單字段
HR = spFormElement-& gt;item( CComVariant( j),CComVariant(),& ampspInputElement);
if(失敗(hr))繼續;
CComVariant vName,vVal,vType//獲取表單域的名稱、值和類型。
hr = spInputElement。GetPropertyByName( L"name ",& ampvName);
if(失敗(hr))繼續;
hr = spInputElement。GetPropertyByName( L"value ",& ampvVal);
if(失敗(hr))繼續;
hr = spInputElement。GetPropertyByName( L"type ",& ampvType);
if(失敗(hr))繼續;
LPCTSTR lpName = vName.bstrVal?
OLE2CT(vname . bstr val):_ T(" NULL ");//未知的域名
LPCTSTR lpVal = vVal.bstrVal?
OLE2CT(vval . bstr val):_ T(" NULL ");//空值,未輸入。
LPCTSTR lpType = vType.bstrVal?
OLE2CT(vtype . bstr val):_ T(" NULL ");//未知類型
// spInputElement.ch
// strMess。格式("名稱=%s值=%s類型=%s\n ",lpName,lpVal,LP type);
//TRACE(strMess);
如果(!BChooseArmHead) //選擇指揮官
{
if( (0 == strcmp(lpName," cid "))
& amp& amp(0 == strcmp(lpType," radio "))
)
{
CComQIPtr & ltIHTMLElement & gtspele(spInputElement);
如果(特殊)
spele->;單擊();
其他
斷言(假);
bChooseArmHead = true
}
}
{//選擇壹個傳送帶。
if( (0 == strcmp(lpName,m_strArmType))
& amp& amp(0 == strcmp(lpType," text "))
)
{
CComQIPtr & ltIHTMLInputTextElement & gtspInputText(spInputElement);
CString應變;
史瑞納姆。格式(" %d ",iAirNum);
spInputText-& gt;put_value(strAirNum。AllocSysString());
}
}
If( 0 == strcmp(lpVal," Next "))
{
CComQIPtr & ltIHTMLInputTextElement & gtspInputText(spInputElement);
CComQIPtr & ltIHTMLInputButtonElement & gtspInputButton(spInputElement);
CComQIPtr & ltIHTMLInputHiddenElement & gtspInputHidden(spInputElement);
CComQIPtr & ltIHTMLSelectElement & gtsp select(spInputElement);
CComQIPtr & ltIHTMLElement & gtspele(spInputElement);
spele->;單擊();
}
}
}
如果妳還是處理不了,我建議把代碼上傳到我的論壇。
論壇地址見我簽名。