IVsWindowFrame frame = null; Guid guid = Guid.NewGuid(); // unique ID for the new window frame // create a new window frame with the given GUID shell.CreateToolWindow(flags, windowId, guid, ref frame); // set some properties of the new frame frame.Caption = "My Window Title"; frame.Width = 600; frame.Height = 400;
object docObj; frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docObj); if (docObj is IVsTextView textView) { // do something with the text view } else if (docObj is IVsCodeWindow codeWindow) { // do something with the code window }This example shows how to get the associated document or view from a window frame. Depending on the type of window frame, the object returned might be an IVsTextView for a text editor or an IVsCodeWindow for a code editor. The package library for IVsWindowFrame is Microsoft.VisualStudio.Shell.Interop.