在的"sign in" to login.live或via msdn.com page的DHTML生成形式的过程似乎是错误操作,使得在找到一个第一IHTMLElement
元件用的tagName“输入”和转换,要一个IHTMLInputElement
字段可以看到它具有类型=“文本”,然而,它在查询时未能提供IHTMLInputTextElement
界面。其他任何输入字段都不为其特定类型提供接口。InternetExplorer在BHO中输入标签类型文本不转换为IHTMLInputTextElement?
相比之下,当击中时,同样的过程也很好。
我对这个错误的来源感到茫然,DHTML,login.live,月亮在错误的阶段? 在IE7和IE8上获取相同的问题,因此似乎不是特定于版本的。 无论IE兼容模式如何,都会遇到同样的问题。
下面是一个简单的例子
TSharedField Factory(CComPtr<IHTMLElement>& _Element)
{
CComQIPtr<IHTMLTextAreaElement> TextAreaField = _Element;
if (TextAreaField)
return TSharedField(new Text(TextAreaField));
CComQIPtr<IHTMLInputTextElement> TextField = _Element;
if (TextField)
return TSharedField(new Text(TextField));
CComQIPtr<IHTMLInputButtonElement> ButtonField = _Element;
if (ButtonField)
return TSharedField(new Button(ButtonField));
CComQIPtr<IHTMLInputFileElement> FileField = _Element;
if (FileField)
return TSharedField(new CWebField_File(FileField));
CComQIPtr<IHTMLInputHiddenElement> HiddenField = _Element;
if (HiddenField)
return TSharedField(new Hidden(HiddenField));
CComQIPtr<IHTMLOptionButtonElement> BooleanField = _Element;
if (BooleanField)
return TSharedField(new Boolean(BooleanField));
CComQIPtr<IHTMLSelectElement> SelectionField = _Element;
if (SelectionField)
return TSharedField(new Select(SelectionField));
CComQIPtr<IHTMLInputImage> ImageField = _Element;
if (ImageField)
return TSharedField(new Image(ImageField));
// Added for debug, only gets hit on login.live
std::wstring type;
HRESULT hr;
DOM_SIMPLE_GET_STRING(type, _Element, get_tagName, hr);
::OutputDebugString(type.c_str());
if(type == L"INPUT"){
CComQIPtr<IHTMLInputElement> Input = _Element;
if(Input){
DOM_SIMPLE_GET_STRING(type, Input, get_type, hr);
::OutputDebugString((type+L"\n").c_str());
}
}
return TSharedField();
}
看起来更专业的接口只是没有创建,所以我已经使用IHTMLInputElement和检查get_type值。因为我需要支持IE6-IE9,我猜这是最好的解决办法,直到它被修复。 – 2011-03-19 02:13:48