Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
ID
Top
Expand Minimize

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 _
) 
[C++]
HRESULT __stdcall get_UserControl(
   /* [out, retval] */ VARIANT_BOOL* retVal
);
HRESULT __stdcall put_UserControl(
   /* [in] */ VARIANT_BOOL NewValue
);
[C#]
public bool UserControl {get; set;}
[JScript .NET]
public function get UserControl() : Boolean
public function set UserControl(
   NewValue : Boolean
)

Parameters

NewValue
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.

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.

Example

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

See Also

Creating Add-Ins and Wizards

Applies To: DTE Object

Show:
© 2015 Microsoft