LanguageService::GetIVsTextMacroHelperIfRecordingOn Method ()

 

Returns an IVsTextMacroHelper object if macro recording is turned on.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
IVsTextMacroHelper^ GetIVsTextMacroHelperIfRecordingOn()

Return Value

Type: Microsoft.VisualStudio.TextManager.Interop::IVsTextMacroHelper^

If successful, returns an IVsTextMacroHelper object; otherwise, returns a null value.

The IVsTextMacroHelper object is obtained by calling LanguageService::GetService with the GUID of the SVsTextManager service and casting the returned object to an IVsTextMacroHelper object.

The following is an example of how this method is implemented in the base LanguageService class.

namespace Microsoft.VisualStudio.Package
{
    [CLSCompliant(false), ComVisible(true)]
    public abstract class LanguageService
        : IDisposable
        , IVsLanguageInfo
        , IVsLanguageDebugInfo
        , IVsProvideColorableItems
        , IVsLanguageContextProvider
        , IOleServiceProvider
        , IObjectWithSite
        , ISynchronizeInvoke
        , IVsDebuggerEvents
        , IVsFormatFilterProvider
    { 
        public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()
        {
            if (IsMacroRecordingOn()) {
                IVsTextManager textmgr = (IVsTextManager)this.GetService(
                                             typeof(SVsTextManager));
                return (IVsTextMacroHelper)textmgr;
            }
            return null;
        }
    }
}
Return to top
Show: