locked
Native equivalent for ICompletionBroker.IsCompletionActive RRS feed

  • Question

  • I'm developing a VSPackage using native C++ and am trying to trigger my action on TAB key press by adding command filter to every IVsTextView on its creation.

    Everything works great so far, however I would like to handle situation when autocomplete intellisense window is active. For MEF extensions there is a ICompletionBroker interface that has method IsCompletionActive which does excatly what I need. However I cannot find its native equivalent. Is there any way I can re-create its functionality using pure COM interfaces or some other trick that does the job? I was thinking about comparing TextView HWND to the result of GetForegroundWindow but before I go that far I'd like to make sure that there is no official way of doing this.

    Thanks in advance!

    Saturday, January 5, 2013 3:08 PM

Answers

  • The new (2010+) editor interfaces are MEF (managed) only, there is no COM equivalent for them. The HWND returned by the TextView is not the real HWND for the editor, there is no HWND for the editor as it is written in WPF. It is an HWND to an invisible window that is there for back-compat only (and all it does is listen for WM_SETFOCUS and forward focus to the WPF editor).

    I think your best bet would be to write a little helper layer in C++/CLI that talked to MEF and was callable from your native client.

    Saturday, January 5, 2013 3:59 PM