次の方法で共有


Macros.IsRecording プロパティ

マクロ レコーダーが現在記録処理を行っているかどうかを示します。 このプロパティはマクロから使用しないでください。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property IsRecording As Boolean
bool IsRecording { get; }
property bool IsRecording {
    bool get ();
}
abstract IsRecording : bool with get
function get IsRecording () : boolean

プロパティ値

型 : Boolean
ブール値の true は、マクロ レコーダーが現在操作を記録中であることを示します。false は、記録中でないことを示します。

解説

IsRecording はアドインでだけ使用します。マクロでは使用しません。

public void CodeExample(DTE2 dte, AddIn addin)
{
    // INSTRUCTIONS: Run this code, open a solution, start
    // recording a macro, then connect the addin containing this code.
    try
    {
        Macros mac = dte.Macros;
        if (mac.IsRecording)
        {
            mac.Pause();
            if (!mac.IsRecording)
                mac.Resume();
            mac.EmitMacroCode("rem Code added by the EmitMacroCode method");
            // Demonstrate these two properties return the same reference.
            bool test = mac.DTE.Equals(mac.Parent);
            if (test) MessageBox.Show("The DTE and Parent property refer to the same object.");
            else MessageBox.Show("The DTE and Parent property do not refer to the same object.");
        }
        else MessageBox.Show("Start a macro recording session and reconnect addin");
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Macros インターフェイス

EnvDTE 名前空間

その他の技術情報

Automating Repetitive Actions by Using Macros