keyword "event_source" must in conjunction with "event_receiver"? 
Author Message
 keyword "event_source" must in conjunction with "event_receiver"?

My application is server.exe + client.exe.
server.exe is written in VC.Net, ATL, a free Threading
model COM Server, as bellow:
        helpstring("NServer Class")
class ATL_NO_VTABLE NServer :
        public INServer
        __event __interface _INServerEvents;


        HRESULT FinalConstruct();
        void FinalRelease();

        void FireEvent1(ULONG id, const CStringW& msg);
        void FireEvent2( ULONG id, const CStringW& msg);



void NServer::Fire_Event1(ULONG id, const CStringW& msg )
    _bstr_t s(msg);
    __raise OnEvent1( id, s );

void NServer::Fire_Event2(ULONG id, const CStringW& msg)
    _bstr_t s(msg);
    __raise OnEvent2( id, s );


client.exe is written C++ Builder 6, in C++ Builder, use
menu item "import typelibrary" to make a NServer Wrapper
class component, then add the component to client.exe

TMainForm::NServerEvent1( ULONG id, BSTR msg )
    AnsiString MsgString( msg );
    ::SysFreeString( msg );
    TestEdit->Lines->Add( MsgString );


TMainForm::NServerEvent2( ULONG id, BSTR msg )
    AnsiString MsgString( msg );
    ::SysFreeString( msg );
    TestEdit->Lines->Add( MsgString );


when running, client can show message received from
server, no error.

but when server fire events again and again, then memory
used become more and more in BOTH server and client, as
shown in task manager. it must be memory leak, but i can
not find any improper code in my program.

MSDN says "event_source is used in conjunction with the
event_receiver attribute and the __event keyword. Use
event_receiver to create event receivers. Use __event on
methods within the event source to specify those methods
as events."

BUT is "event_source" MUST in conjunction with
the "event_receiver" ?

i don't know reason, so guess it is.
WHO can help me? MANY THANKS!

Thu, 28 Apr 2005 18:35:06 GMT  
 [ 1 post ] 

 Relevant Pages 

1. remove() vrs fopen("""w")

2. "Useless keyword..." warning

3. the "new" keyword in the polymorph

4. The "this" keyword noob question

5. Displaying binary data as ascii "1"'s and "0"'s

6. "volatile" keyword

7. Looking for "Shroud"/"Obfus"

8. the "auto" keyword and reentrancy

9. ""help with TSR""

10. Problem using the "extern" keyword

11. MIDL bug using keyword "enable"

12. About the "extern" keyword


Powered by phpBB® Forum Software