0 out of 5 rated this helpful - Rate this topic

Windows.CreateToolWindow Method

Creates a new tool window containing the specified Document object or ActiveX control.

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

Window CreateToolWindow (
	[InAttribute] AddIn AddInInst,
	[InAttribute] string ProgID,
	[InAttribute] string Caption,
	[InAttribute] string GuidPosition,
	[InAttribute] out Object DocObj
)
Window CreateToolWindow (
	/** @attribute InAttribute() */ AddIn AddInInst, 
	/** @attribute InAttribute() */ String ProgID, 
	/** @attribute InAttribute() */ String Caption, 
	/** @attribute InAttribute() */ String GuidPosition, 
	/** @attribute InAttribute() */ /** @attribute OutAttribute() */ /** @ref */ Object DocObj
)
JScript does not support passing value-type arguments by reference.

Parameters

AddInInst

Required. An AddIn object whose lifetime determines the lifetime of the tool window.

ProgID

Required. The programmatic ID of the Document object or ActiveX control.

Caption

Required. The caption for the new tool window.

GuidPosition

Required. A unique identifier for the new tool window, which can be used as an index to Item.

DocObj

Required. The Document object or control to be hosted in the tool window.

Return Value

A Window object.

If you attempt to set any of the visibility states of the new tool window — such as height, width, or position — before the tool window is visible, you get an error. Therefore, make sure that the window is visible before attempting to set any such properties.

For an example of how to use this method, see the ToolWindow sample on the Visual Studio Automation Samples Web page: http://msdn.microsoft.com/vstudio/downloads/samples/automation.asp. For information about creating ActiveX controls, see Creating an MFC ActiveX Control.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
CreateToolWindow and .NET User Controls

Previous versions of Visual Studio did not have the ability to create tool windows using .NET user controls. Instead, an unsupported ActiveX control was available which would enable this functionality. Versions of Visual Studio after VS 2005 do support hosting .NET User Controls registered as ActiveX controls, however it is preferrable that the method Windows2.CreateToolWindow2 is used to host the control directly rather than going through an ActiveX interop mechanism.

New windows are created invisible
When you use the CreateToolWindow method, all newly created tool windows will be created invisible. You will need to set the Window.Visible property to true to show the new tool window.
.NET User Control support
While more recent versions of the .NET Framework supports hosting .NET User Controls as ActiveX controls, you should use the method Windows2.CreateToolWindow2 to host a .NET control as a tool window.
Advertisement