質問

I'm implementing a custom IEnumString to be used as a dataset for an IAutoComplete2 object.

The problem is that IAutoComplete2 appears to only call reset on my IEnumString when the first character is entered in an editbox and then relies on the fact that the dataset remains static (and doing local filtering after that) during subsequent key presses.

I tried to remove the IAutoComplete2 object and then immedietely creating a new one and attaching it to the control, but this lead to a crash in shell32.

Is this even possible?

役に立ちましたか?

解決

When you want to reset the enumeration, you should QueryInterface your IAutoComplete interface for IAutoCompleteDropDown and then call ResetEnumerator.

Creation:

    CComPtr<IAutoComplete> m_spAutoComplete;

    CHECKHR(CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_spAutoComplete)));

When you want to reset the enumeration:

    CComPtr<IAutoCompleteDropDown> spAutoCompleteDD;
    CHECKHR(m_spAutoComplete->QueryInterface(IID_PPV_ARGS(&spAutoCompleteDD)));
    CHECKHR(spAutoCompleteDD->ResetEnumerator()); 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top