使用 IEnumString 的 IAutoComplete 自定义源
我正在尝试为组合框(win32,c++)或编辑控件实现自动建议。但我不知道如何正确使用IAutoComplete接口。我需要一个自定义字符串列表,应从中获取自动建议的匹配项。但是如何用 IEnumString 来实现呢?我找到了此链接,但它并未显示所有内容: http://msdn.microsoft.com/en-us/library/windows/desktop/hh127437%28v=vs.85%29.aspx
有人曾经实现过这个吗? 提前谢谢 迈克尔
I am trying to implement auto-suggest for a comboxbox (win32, c++) or an edit-control. But I dont know how to use the interface IAutoComplete correctly. I need a custom list of strings where the matches for auto-suggest should be taken from. But how to implement this with IEnumString? I found this link but it doesnt reveal everything: http://msdn.microsoft.com/en-us/library/windows/desktop/hh127437%28v=vs.85%29.aspx
Has anybody ever implemented this?
Thx in advance
Michael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如我在评论中指出的,ATL 已经为您预先编写了一份。
该代码基本上是从CComEnum 文档。
As I noted in my comment, ATL has one pre-written for you.
That code was basically stolen from the CComEnum documentation.
好的,在所有答案的帮助下,我到目前为止得到了它:
只剩下一件事:
CComObject *pes 的初始化。假设我有一个像这样的数组:
现在我希望将这些字符串填充到 pes->Init(...) 方法中。这里实际上是如何转换为 LPOLESTR 的? Init(...) 方法包含一个指向该数组的开头和结尾的指针。结尾应该是最后一个数组元素之外的一个位置,那么这里是 myArray[3] 吗?我只是问,因为我认为这实际上超出了这个数组的范围?
非常感谢!
Ok, with the help of all answers I got it so far:
There is just one thing remaining:
The initialisation of the CComObject *pes. Lets assume I have an array like this:
Now I want these strings to be stuffed into the pes->Init(...) method. How is the conversion to LPOLESTR actually done here? The Init(...) method taes a pointer to the begin and end of this array. The end should be one position BEYOND the last array element, so would this be myArray[3] here? I am just asking because I think this is actually out of bounds in this array?
Thx very much!