Hi,
I need to access CurrentTheme.ThemeId of IVsColorThemeService in VS. Although it is delared as "public" inMicrosoft.VisualStudio.Shell.12.0.dll, it seems that I could not use the types. I defined my own com import interfaces but still have problems when I try to cast the object returned by GetService()...
// no issue object dd = this.GetService(typeof(Microsoft.Internal.VisualStudio.Shell.Interop.SVsColorThemeService)); // cast exception will be thrown IVsColorThemeService service= (IVsColorThemeService)this.GetService(typeof(SVsColorThemeService));
the followings is my imported interfaces.
namespace Microsoft.Internal.VisualStudio.Shell.Interop1
{
[ComImport, Guid("BBE70639-7AD9-4365-AE36-9877AF2F973B"), TypeIdentifier, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CompilerGenerated]
public interface IVsColorEntry
{
void _VtblGap1_1();
byte BackgroundType { get; }
byte ForegroundType { get; }
uint Background { get; }
uint Foreground { get; }
}
[ComImport, CompilerGenerated, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier, DefaultMember("Item"), Guid("92144F7A-61DE-439B-AA66-13BE7CDEC857")]
public interface IVsColorNames
{
void _VtblGap1_3();
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "", MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler), MarshalCookie = "")]
IEnumerator GetEnumerator();
}
[ComImport, CompilerGenerated, DefaultMember("Item"), TypeIdentifier, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("413D8344-C0DB-4949-9DBC-69C12BADB6AC")]
public interface IVsColorTheme
{
void _VtblGap1_2();
Guid ThemeId { get; }
}
[ComImport, TypeIdentifier, CompilerGenerated, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("98192AFE-75B9-4347-82EC-FF312C1995D8"), DefaultMember("Item")]
public interface IVsColorThemes
{
[return: MarshalAs(UnmanagedType.Interface)]
IVsColorTheme GetThemeFromId([In] Guid ThemeId);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CompilerGenerated, Guid("EAB552CF-7858-4F05-8435-62DB6DF60684"), TypeIdentifier]
public interface IVsColorThemeService
{
void _VtblGap1_4();
IVsColorThemes Themes { [return: MarshalAs(UnmanagedType.Interface)] get; }
IVsColorNames ColorNames { [return: MarshalAs(UnmanagedType.Interface)] get; }
IVsColorTheme CurrentTheme { [return: MarshalAs(UnmanagedType.Interface)] get; }
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CompilerGenerated, Guid("0D915B59-2ED7-472A-9DE8-9161737EA1C5"), TypeIdentifier]
public interface SVsColorThemeService
{
}
}can anyone help me here?
Thanks,
Vince