PC Review


Reply
Thread Tools Rate Thread

creting event handler client in vc++ for Source c# event

 
 
Mayur
Guest
Posts: n/a
 
      1st Sep 2006
Hello all,

Can any one have the source of How to add event handler in unmanaged MFC
application for
event source which is in Managed(c# class library).

Here is the Event Source code
:
namespace ircConnect

{

public class IrcConnection

{

public delegate void MessageEventHandler(object sender,MessageEventArgs e);

public event MessageEventHandler MessageIncome;

}End Class







Event Client

void CADONET_MFCDlg::OnFilling() //This is the MFC dialog box event

{

#pragma push_macro("new")

#undef new

try

{

m_IrcConnection =new IrcConnection();

FileWatcherEvents *f=new FileWatcherEvents();

m_IrcConnection->add_MessageIncome=new
IrcConnection::MessageEventHandler(m_IrcConnection,OnMessageIncome);

};



im using gcroot template
gcroot<IrcConnection*> m_IrcConnection;

gcroot<IrcMessage*> m_IrcMessage;



void static OnMessageIncome( Object* sender,
IrcConnection::MessageEventHandler* e );

but the compile time error generated as follows

error C3363: 'void CADONET_MFCDlg::OnMessageIncome(System::Object __gc
*,ircConnect::IrcConnection::MessageEventHandler __gc *)' : cannot create a
delegate handler for 'ircConnect::IrcConnection::MessageEventHandler' from a
non-member function or a member of an unmanaged class




 
Reply With Quote
 
 
 
 
Willy Denoyette [MVP]
Guest
Posts: n/a
 
      1st Sep 2006

"Mayur" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| Hello all,
|
| Can any one have the source of How to add event handler in unmanaged MFC
| application for
| event source which is in Managed(c# class library).
|
| Here is the Event Source code
| :
| namespace ircConnect
|
| {
|
| public class IrcConnection
|
| {
|
| public delegate void MessageEventHandler(object sender,MessageEventArgs
e);
|
| public event MessageEventHandler MessageIncome;
|
| }End Class
|
|
|
|
|
|
|
| Event Client
|
| void CADONET_MFCDlg::OnFilling() //This is the MFC dialog box event
|
| {
|
| #pragma push_macro("new")
|
| #undef new
|
| try
|
| {
|
| m_IrcConnection =new IrcConnection();
|
| FileWatcherEvents *f=new FileWatcherEvents();
|
| m_IrcConnection->add_MessageIncome=new
| IrcConnection::MessageEventHandler(m_IrcConnection,OnMessageIncome);
|
| };
|
|
|
| im using gcroot template
| gcroot<IrcConnection*> m_IrcConnection;
|
| gcroot<IrcMessage*> m_IrcMessage;
|
|
|
| void static OnMessageIncome( Object* sender,
| IrcConnection::MessageEventHandler* e );
|
| but the compile time error generated as follows
|
| error C3363: 'void CADONET_MFCDlg::OnMessageIncome(System::Object __gc
| *,ircConnect::IrcConnection::MessageEventHandler __gc *)' : cannot create
a
| delegate handler for 'ircConnect::IrcConnection::MessageEventHandler' from
a
| non-member function or a member of an unmanaged class
|
|
|
|

THis is not a C# issue, please post C++ questions to the vc NG
<microsoft.public.dotnet.languages.vc> , that said, the error message tells
it all, your MessageEventHandler' delegate must be created from a managed
class.

Willy.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a client event handler to tags other than the tagkey Nathan Sokalski Microsoft ASP .NET 1 1st Nov 2007 08:31 AM
Re: calling client-side function in girdview event handler? bruce barker Microsoft ASP .NET 0 8th Dec 2006 05:25 PM
creting event handler client in vc++ for Source c# event Mayur Microsoft VC .NET 2 1st Sep 2006 12:28 PM
Re: creting event handler client in vc++ for Source c# event SvenC Microsoft VC .NET 0 1st Sep 2006 08:43 AM
How to ref web form controls in client side event handler? Eric Microsoft ASP .NET 3 9th Nov 2004 01:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.