LanguageService.IsMacroRecordingOn Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called to determine if macro recording is turned on.
public:
bool IsMacroRecordingOn();
public:
bool IsMacroRecordingOn();
bool IsMacroRecordingOn();
public bool IsMacroRecordingOn ();
member this.IsMacroRecordingOn : unit -> bool
Public Function IsMacroRecordingOn () As Boolean
Returns
Returns true
if macro recording is on; otherwise, returns false
.
Examples
Here is an example of how this method is implemented in the base LanguageService class.
using Microsoft.VisualStudio.Package;
namespace MyLanguagePackage
{
[Guid("B614A40A-80D9-4fac-A6AD-FC2868FFF7CD")]
public class MyLanguageService : LanguageService
{
public bool IsMacroRecordingOn()
{
IVsShell shell = this.GetService(typeof(SVsShell)) as IVsShell;
if (shell != null)
{
object pvar;
int hr;
hr = shell.GetProperty( (int)__VSSPROPID.VSSPROPID_RecordState,
out pvar);
if (hr != VSConstants.S_OK)
{
throw Marshal.ThrowExceptionForHR(hr);
}
shell = null;
if (pvar != null)
{
return ((VSRECORDSTATE)pvar == VSRECORDSTATE.VSRECORDSTATE_ON);
}
}
return false;
}
}
}