Właściwość Macros.DTE —

Pobiera obiekt rozszerzalności najwyższego poziomu.

Przestrzeń nazw:  EnvDTE
Zestaw:  EnvDTE (w EnvDTE.dll)

Składnia

'Deklaracja
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
    DTE^ get ();
}
abstract DTE : DTE with get
function get DTE () : DTE

Wartość właściwości

Typ: EnvDTE.DTE
A DTE object.

Uwagi

W Visual Studio, DTE obiekt jest katalogu głównego modelu automatyzacji, który innych modeli obiektów często call "Aplikacja".

Przykłady

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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Macros Interfejs

Przestrzeń nazw EnvDTE

Inne zasoby

Porady: kompilowanie i uruchamianie kodu modelu obiektów automatyzacji — przykłady