Re: Need help: ToolWindowPane.Show() fails with E_UNEXPECTED
After I removed the Parameter MultiInstances from the attribute
[ProvideToolWindow(typeof(ToolWindow))], I could reopen the closed
toolwindow. But then I run into another problem: The window state
(docking) is not restored correctly after the VS startup. I tried to
close the window in the Dispose method of my package so that the
position is saved correctly, but that did not work, too.
ToolWindowPane pane = FindToolWindow(typeof(ToolWindow), windowIndex,
false);
if (pane != null)
{
(pane.Frame as IVsWindowFrame).CloseFrame((int)
__FRAMECLOSE.FRAMECLOSE_SaveIfDirty);
pane.Dispose();
}
Here's a short explanation of my package: I'm loading UserControls
from some dlls, and I want to host them in VS. As I don't know how
many toolwindows I have to create, I'm just using one class (the
ToolWindow class). Before I create a toolwindow, I set a static
property to the UserControl I want to host (There is only a
parameterless constructor in the ToolWindow) and then I save this
property in the constructor to an instance field. Well, so far, this
works fine and everything works.
Now I had the problem, that I could not reopen the toolwindows, which
is now solved (at least I hope so). The next problem is now, that the
state of the toolwindows is not restored correctly after startup.
Does anyone know how to solve the docking problem?!
date: Mon, 08 Oct 2007 14:29:08 -0000
author: markus