ATL: Fire events
Posted on 2001-08-31
i have a component in which i wish to fire an event like
[id(0x00000009), helpstring("method Validate")] HRESULT Validate(VARIANT_BOOL *Cancel);
so.. i have a "Validate" event..
somewhere in my code i wish to fire that event and, if implemented by the containing form, continue or not the execution by checking the returned "Cancel" variable..
thus.. somewhere in my code (let's say when i loose focus) i do
VARIANT_BOOL *pbCancel = new VARIANT_BOOL(0);
//do my stuff
maybe i am wrong (because my deficitary knowledge in ATL/COM), but doing this seems the right thing to me..
even so, this code crashes on Fire_Validate.. it's clear is a problem when passing the pointer further, but i've tried to allocate it staticaly or dynamically, but i have the same result (access violation).
maybe someone had this problem before or knows how to handle it..