Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / April 2005

Tip: Looking for answers? Try searching our database.

IDesignerHost for Web Form in Beta 1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephen Hardeman - 23 Mar 2005 22:19 GMT
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]
> >         }
> >     }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.