Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly hide methods and properties from intellisense

Tags:

c++

interop

com

idl

Would anyone know how to properly hide classes, methods and properties from intellisense while preserving the ability to call them; and so they do not appear in interop assemblies that are generated from a type library?

I'm writing API hooks for automated testing we don't want exposed to consumers yet. This appears to work well from the built in SaxBasic editor our application comes with, but fails to hide the objects, methods and properties when a reference is added to our interop assembly.

Here's an example of how I'm attempting to hide these; various permutations have been tried, thanks in advance!

    [
    object,
    uuid(guid),
    helpstring("help"),
    version(ver),
    dual,
    nonextensible,
    oleautomation,
    pointer_default(unique)
]IApplication.VisibleObj
interface IObj : IDispatch
{
        //tried [hidden] here, no luck
 [propget, id(91001), helpstring("Help str. Available as of Object Model Version X.X.X."), hidden]//again tried [hidden] here, no luck
    HRESULT Obj([out, retval] IObj** ppObj);
}
like image 588
BrMcMullin Avatar asked Aug 26 '10 21:08

BrMcMullin


1 Answers

It appears Visual Studio 2008 and 2010 now ignore the 'hidden' attribute, making otherwise hidden interfaces browseable. It appears the interop assembly must be modified by adorning the following over classes, methods and properties that are intended to exist but not be browseable:

[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]

Source: http://www.summsoft.com/blogs/garyvsta/archive/2009/02/06/preserving-hidden-elements-in-a-com-interop-assembly.aspx

like image 93
BrMcMullin Avatar answered Oct 10 '22 14:10

BrMcMullin