DTE2.UserControl DTE2.UserControl DTE2.UserControl DTE2.UserControl DTE2.UserControl Property


Gets a value indicating whether the environment was started by a user or by automation.

 property bool UserControl { bool get(); void set(bool value); };
 property bool UserControl { bool get(); void set(bool value); };
[get: System.Runtime.InteropServices.DispId(227)]
[set: System.Runtime.InteropServices.DispId(227)]
public bool UserControl { get; set; }
member this.UserControl : bool with get, set
Public Property UserControl As Boolean
Property Value

true if the environment is running under user control; otherwise, false.



Sub UserControlExample()  
   MsgBox("Environment is running under user control?: " & DTE2.UserControl)  
End Sub  


UserControl can be set to true, indicating that a human is interacting with the environment. Once this is done, you cannot change it back to false.

If the environment is not under user control, and the last external automation client disconnects, then the environment shuts down.

If you start the environment through the Start menu, it is user-created and UserControl is set to true. If the environment is started by CoCreate, however, it is automation-created and UserControl is set to false.

You can control the visibility of the main window through automation only when UserControl is set to false. After it is irreversibly set to true, the main window cannot be hidden.

Manually attempting to open a new solution or document causes UserControl to be set to true. Automatically attempting to do the same does not affect the value.

Applies to