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 / .NET Framework / Interop / September 2004

Tip: Looking for answers? Try searching our database.

event fired by C# component not traped in VC.NET(ATL composit cont

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
satyaprakash - 29 Sep 2004 05:53 GMT
Hi Everybody,
We have  C# component. which has been hosted in ATL composit control.
we are trying to caught event fired by C# component in ATL component.
we have implemented sink class derived from IDispEventImpl.
our call to  DispEventAdvise method failed with error code  - " 0x80040200"
not getting connection point.
Please suggest how event is captured in ATL component.
Regards,
satya
vijai thoppae - 29 Sep 2004 20:43 GMT
Satya,

Here's an example of how things are defined in C# for ATL to catch the
event.
Define a delegate & a corresponding event. Also an interface containing
equivalent method. Note the event instance name, must be same as the
interface method for AtlAdvise to succeed.
public event DefaultButtonHandler DefaultButton;

// Delegate Definitions...

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

public interface IHostMessageSink

{

[DispId(1)] void DefaultButton(int nCtrlIndex);

}

//C# side

public delegate void DefaultButtonHandler(int nCtrlIndex);

[

ComVisible(true),

Guid("1A151E44-FE24-4172-8D5D-FD7A30BA85EB"),

ClassInterface(ClassInterfaceType.None),

ComSourceInterfaces(typeof(IHostMessageSink))

]

public class CWindowHost : System.Windows.Forms.UserControl

{

// Event Definitions..

public event DefaultButtonHandler DefaultButton;

}

Try this out.

Thanks,

VT

> Hi Everybody,
> We have  C# component. which has been hosted in ATL composit control.
[quoted text clipped - 5 lines]
> Regards,
> satya

Rate this thread:







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.