_DTE.UserControl Property

Sets or gets a value indicating whether the environment was launched by a user or by automation.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Property UserControl As Boolean
'Usage
Dim instance As _DTE 
Dim value As Boolean 

value = instance.UserControl

instance.UserControl = value
bool UserControl { get; set; }
property bool UserControl {
    bool get ();
    void set (bool value);
}
function get UserControl () : boolean 
function set UserControl (value : boolean)

Property Value

Type: System.Boolean
true if the environment is running under user control; otherwise, false.

Remarks

UserControl can be set to true, indicating that a human is interacting with the environment, but once this is done, an Add-in or macro 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. Once 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.

Examples

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

.NET Framework Security

See Also

Reference

_DTE Interface

_DTE Members

EnvDTE Namespace

Other Resources

Creating Add-ins and Wizards