Re: COM Interop question in .NET 2.0
- From: "Vish" <Vish@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Nov 2005 13:12:03 -0800
Hi,
Ok. I am not sure why but it did fix the issue. Obviously y'all know more on
this subject than i do. But i am posting my code below if y'all are still
interested.
[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]
[ComVisible(true)]
public sealed class TestTool : BaseCommand
{
private IApplication m_app;
public override void OnCreate(object hook)
{
if (hook != null)
{
if (hook is IMxApplication)
{
m_app = (IApplication)hook;
}
}
}
public override void OnClick()
{
IMxDocument mxDoc = (IMxDocument)m_app.Document;
IActiveView activeView = mxDoc.ActiveView;
activeView.Extent = activeView.FullExtent;
activeView.Refresh();
}
public TestTool()
{
base.m_category = "Vish's Test";
base.m_caption = "Full Extent C#";
base.m_message = "Zooms the display to its full extent";
base.m_toolTip = "Full Extent C#";
base.m_name = "Developer Samples_FullExtent C#";
string[] res = GetType().Assembly.GetManifestResourceNames();
if (res.GetLength(0) > 0)
{
base.m_bitmap = new
System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(res[0]));
}
}
#region Component Category Registration
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(String regKey)
{
MxCommands.Register(regKey);
}
[ComUnregisterFunction()]
[ComVisible(false)]
static void UnregisterFunction(String regKey)
{
MxCommands.Unregister(regKey);
}
#endregion
}
"Willy Denoyette [MVP]" wrote:
>
> "Jason Newell" <nospam@xxxxxxxxxx> wrote in message
> news:eCS0FVK5FHA.4036@xxxxxxxxxxxxxxxxxxxxxxx
> > Yeah I know it's always been default because it's bitten me in the
> > rear-end a few times ;-). I honestly didn't think that they would have
> > made a breaking change like that. So the question that still remains, did
> > setting [ComVisible(true)] really solve the problem or was it something
> > else?
> >
> >
> > Jason Newell
> >
> >
>
> Pretty sure it was something else (my guess: missing public on the class).
>
> Willy.
>
>
>
>
>
.
- References:
- Re: COM Interop question in .NET 2.0
- From: Jason Newell
- Re: COM Interop question in .NET 2.0
- From: Willy Denoyette [MVP]
- Re: COM Interop question in .NET 2.0
- From: Jason Newell
- Re: COM Interop question in .NET 2.0
- From: Willy Denoyette [MVP]
- Re: COM Interop question in .NET 2.0
- Prev by Date: Re: SQL queries in C#....2 question
- Next by Date: Re: SQL queries in C#....2 question
- Previous by thread: Re: COM Interop question in .NET 2.0
- Next by thread: Re: COM Interop question in .NET 2.0
- Index(es):
Relevant Pages
|