Home » U++ Library support » U++ Widgets - General questions or Mixed problems » OcxConnectionPointContainer
OcxConnectionPointContainer [message #4795] |
Tue, 22 August 2006 15:51  |
mrmodolo
Messages: 3 Registered: August 2006
|
Junior Member |
|
|
Hi in manual I found a example:
class MyViewOcx
: public OcxControl // handles OCX control client functionality
, public DispatchInterface<IMyView> // custom control's interface
, public OcxConnectionPointContainer // needed only for callback (aka event) interface
I make a ocx control and put It in VisualBasic express edition, I like to add a Event, I update the idl file:
dispinterface _ICalculadoraOCX_Events
{
properties:
methods:
[id(1), helpstring("Evento Resultado")]
HRESULT OnResultado();
};
with dispinterface now I can see in VB the event. But I do not know how can I fire the event from UPP ocx control
thanks,
marcelo módolo
|
|
|
Re: OcxConnectionPointContainer [message #4815 is a reply to message #4795] |
Tue, 22 August 2006 23:36  |
rylek
Messages: 79 Registered: November 2005
|
Member |
|
|
Hello!
It's a little tricky but manageable. First, you have to derive your object from OcxConnectionPointContainer and create a member variable, say "events" (probably an IRef) to hold the pointer to your event interface, possibly even multiple variables if you intend to support multiple outgoing interfaces. Then, perhaps in the object constructor, use:
events = new OcxObjectWrapper<OcxConnectionPoint>();
events->SetEventGUID(__uuidof(<your event interface>));
AddConnectionPoint(~events);
(AddConnectionPoint is a method of the OcxConnectionPointContainer interface). After that, you can use the method FireEvent of the OcxConnectionPoint interface:
void FireEvent(int method_id, const Vector<Value>& values);
To fire IUnknown / IDispatch values, use the DispatchToValue / UnknownToValue global functions (declared in Ole/Ole.h).
Please note this is thin ice; if you run into any trouble, please feel free to pester us until we fix it.
Regards
Tomas
[Updated on: Tue, 22 August 2006 23:37] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 18:30:18 CEST 2025
Total time taken to generate the page: 0.00870 seconds
|