This documentation is archived and is not being maintained.

UserControl Property (DTE Object)

Visual Studio .NET 2003

Returns whether the environment was launched by a user or by automation.

[Visual Basic .NET]
Public Property UserControl() As Boolean
[Visual Basic 6]
Property Get UserControl() As Boolean
Property Let UserControl( _
   ByVal NewValue As Boolean _
HRESULT __stdcall get_UserControl(
   /* [out, retval] */ VARIANT_BOOL* retVal
HRESULT __stdcall put_UserControl(
   /* [in] */ VARIANT_BOOL NewValue
public bool UserControl {get; set;}
[JScript .NET]
public function get UserControl() : Boolean
public function set UserControl(
   NewValue : Boolean


If True, the environment is running under user control. If False, the environment is running under automation control..

Return Value

Returns True if the environment is running under user control, False if not.


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.


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

See Also

Creating Add-Ins and Wizards

Applies To: DTE Object