Partager via


LanguageService.GetIVsTextMacroHelperIfRecordingOn Method

Returns an IVsTextMacroHelper object if macro recording is turned on.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Déclaration
Public Function GetIVsTextMacroHelperIfRecordingOn As IVsTextMacroHelper
'Utilisation
Dim instance As LanguageService
Dim returnValue As IVsTextMacroHelper

returnValue = instance.GetIVsTextMacroHelperIfRecordingOn()
public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()
public:
IVsTextMacroHelper^ GetIVsTextMacroHelperIfRecordingOn()
member GetIVsTextMacroHelperIfRecordingOn : unit -> IVsTextMacroHelper 
public function GetIVsTextMacroHelperIfRecordingOn() : IVsTextMacroHelper

Return Value

Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextMacroHelper
If successful, returns an IVsTextMacroHelper object; otherwise, returns a null value.

Remarks

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.

Examples

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;
        }
    }
}

.NET Framework Security

See Also

Reference

LanguageService Class

LanguageService Members

Microsoft.VisualStudio.Package Namespace