The steps that used to work for getting access to the IDesignerHost for a web
form no longer seem to work in Visual Studio 2005 Beta 1. Below is the code
that works on 2003. When running this code in 2005 the cast to IDesignerHost
always returns null.
DTE dte = (DTE)GetService(typeof(DTE));
HTMLWindow hw = dte.ActiveWindow.Object as HTMLWindow;
object o = hw.CurrentTabObject;
IOleServiceProvider oleSP = o as IOleServiceProvider;
IntPtr pObject;
Guid sid = typeof(IVSMDDesigner).GUID;
Guid iid = typeof(IVSMDDesigner).GUID;
int hr = oleSP.QueryService(ref sid, ref iid, out pObject);
IDesignerHost designerHost = null;
if (pObject != IntPtr.Zero)
{
try
{
System.Object obj = Marshal.GetObjectForIUnknown(pObject);
designerHost = obj as IDesignerHost;
}
finally
{
Marshal.Release(pObject);
}
}
Stephen Hardeman - 23 Mar 2005 23:47 GMT
I figured it out. From the below code you need to replace:
designerHost = obj as IDesignerHost;
with
DesignSurface designSurface = obj as DesignSurface;
designerHost = designSurface.Container as IDesignerHost;
> The steps that used to work for getting access to the IDesignerHost for a web
> form no longer seem to work in Visual Studio 2005 Beta 1. Below is the code
[quoted text clipped - 24 lines]
> }
> }
Anuj - 07 Apr 2005 06:41 GMT
Hi all,
Can someone tell me about IServiceProvider and IVSMDDesigner am i missing
some reference........
regards and thanks,
> The steps that used to work for getting access to the IDesignerHost for a web
> form no longer seem to work in Visual Studio 2005 Beta 1. Below is the code
[quoted text clipped - 24 lines]
> }
> }
Anuj - 07 Apr 2005 08:09 GMT
Can someone tell me about IOleServiceProvider and IVSMDDesigner, am i
missing any reference? i am not getting hold of the dll containing this
interface. Please help me out.
regards and thanks
anuj
> The steps that used to work for getting access to the IDesignerHost for a web
> form no longer seem to work in Visual Studio 2005 Beta 1. Below is the code
[quoted text clipped - 24 lines]
> }
> }
W Jansoone - 15 Apr 2005 10:28 GMT
Look here:
IVSMDDesigner:
C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\Microsoft.VisualStudio.Designer.Interfaces.dll
IOleServiceProvider:
C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\Microsoft.VSDesigner.dll
W.
> Can someone tell me about IOleServiceProvider and IVSMDDesigner, am i
> missing any reference? i am not getting hold of the dll containing this
[quoted text clipped - 31 lines]
> > }
> > }