EDN Admin
Well-known member
I currently have the following code<br/>
<pre class="prettyprint HRESULT hr = CoInitialize(NULL);
ISTIEventsPtr evnt(__uuidof(STIEvents));
IConnectionPointContainer *point_container;
IConnectionPoint *conn_point;
HRESULT qint = evnt->QueryInterface(IID_IConnectionPointContainer,(void**)&point_container);
HRESULT qpoint = point_container->FindConnectionPoint(__uuidof(_ISTIEventsEvents),&conn_point);[/code]
<br/>
Now that I have a conn_point how do I subscribe to an event ? I know I would have to use the advise method but I am totally confused with the parameter. There are tons of events available but I only want to use one.Here is a snapshot from the tlb file.<br/>
<br/>
[<br/>
uuid(18A8B57B-D223-4796-9948-E2426ED7C9E7),<br/>
helpstring("ISTIEvents Interface"
,<br/>
dual<br/>
]<br/>
dispinterface ISTIEvents {<br/>
properties:<br/>
methods:<br/>
[id(0x00000001), helpstring("method SetOrderEventsAsStructs"
]<br/>
void SetOrderEventsAsStructs([in] VARIANT_BOOL bStruct);<br/>
[id(0x00000002), helpstring("method GetQueueCount"
]<br/>
long GetQueueCount();<br/>
[id(0x00000003), helpstring("method Destroy"
]<br/>
void Destroy();<br/>
};<br/>
<br/>
and the events are as follows<br/>
<br/>
[<br/>
uuid(192B9F3E-DF39-41A5-95E0-0333B061CAB8),<br/>
helpstring("_ISTIEventsEvents Interface"
<br/>
]<br/>
dispinterface _ISTIEventsEvents {<br/>
properties:<br/>
methods:<br/>
[id(0x00000001), helpstring("method OnSTITradeUpdateMsg"
]<br/>
void OnSTITradeUpdateMsg([in] ISTITradeUpdateMsg* oSTITradeUpdateMsg);<br/>
[id(0x00000002), helpstring("method OnSTIOrderUpdateMsg"
]<br/>
void OnSTIOrderUpdateMsg([in] ISTIOrderUpdateMsg* oSTIOrderUpdateMsg);<br/>
[id(0x00000003), helpstring("method OnSTIOrderRejectMsg"
]<br/>
void OnSTIOrderRejectMsg([in] ISTIOrderRejectMsg* oSTIOrderRejectMsg);<br/>
[id(0x00000004), helpstring("method OnSTIOrderConfirmMsg"
]<br/>
void OnSTIOrderConfirmMsg([in] ISTIOrderConfirmMsg* oSTIOrderConfirmMsg);<br/>
[id(0x00000005), helpstring("method OnSTITradeUpdate"
]<br/>
void OnSTITradeUpdate([in] structSTITradeUpdate* structTradeUpdate);<br/>
[id(0x00000006), helpstring("method OnSTIOrderUpdate"
]<br/>
void OnSTIOrderUpdate([in] structSTIOrderUpdate* structOrderUpdate);<br/>
[id(0x00000007), helpstring("method OnSTIOrderReject"
]<br/>
void OnSTIOrderReject([in] structSTIOrderReject* structOrderReject);<br/>
[id(0x00000008), helpstring("method OnSTIOrderConfirm"
]<br/>
void OnSTIOrderConfirm([in] structSTIOrderConfirm* structOrderConfirm);<br/>
[id(0x00000009), helpstring("method OnSTIShutdownStruct"
]<br/>
HRESULT OnSTIShutdown();<br/>
[id(0x0000000a), helpstring("method OnSTILinkSymChange"
]<br/>
void OnSTILinkSymChange([in] structSTILink* structLink);<br/>
[id(0x0000000b), helpstring("method OnSTIDrop"
]<br/>
void OnSTIDrop([in] structSTIDrop* structDrop);<br/>
[id(0x0000000c), helpstring("method OnSTITradeUpdateXML"
]<br/>
HRESULT OnSTITradeUpdateXML([in] BSTR* bstrTrade);<br/>
[id(0x0000000d), helpstring("method OnSTIOrderUpdateXML"
]<br/>
HRESULT OnSTIOrderUpdateXML([in] BSTR* bstrOrder);<br/>
[id(0x0000000e), helpstring("method OnSTIOrderRejectXML"
]<br/>
HRESULT OnSTIOrderRejectXML([in] BSTR* bstrOrder);<br/>
[id(0x0000000f), helpstring("method OnSTIOrderConfirmXML"
]<br/>
HRESULT OnSTIOrderConfirmXML([in] BSTR* bstrOrder);<br/>
};<br/>
<br/>
I only want to use the last event which is<br/>
<br/>
HRESULT OnSTIOrderConfirmXML([in] BSTR* bstrOrder);<br/>
<br/>
is it possible to use only one event and ignore the others ? and how would I subscribe to it ? Any suggestions would be appreciated<br/>
<br/>
<br/>
<
A candle loses nothing by lighting another candle.
View the full article
<pre class="prettyprint HRESULT hr = CoInitialize(NULL);
ISTIEventsPtr evnt(__uuidof(STIEvents));
IConnectionPointContainer *point_container;
IConnectionPoint *conn_point;
HRESULT qint = evnt->QueryInterface(IID_IConnectionPointContainer,(void**)&point_container);
HRESULT qpoint = point_container->FindConnectionPoint(__uuidof(_ISTIEventsEvents),&conn_point);[/code]
<br/>
Now that I have a conn_point how do I subscribe to an event ? I know I would have to use the advise method but I am totally confused with the parameter. There are tons of events available but I only want to use one.Here is a snapshot from the tlb file.<br/>
<br/>
[<br/>
uuid(18A8B57B-D223-4796-9948-E2426ED7C9E7),<br/>
helpstring("ISTIEvents Interface"

dual<br/>
]<br/>
dispinterface ISTIEvents {<br/>
properties:<br/>
methods:<br/>
[id(0x00000001), helpstring("method SetOrderEventsAsStructs"

void SetOrderEventsAsStructs([in] VARIANT_BOOL bStruct);<br/>
[id(0x00000002), helpstring("method GetQueueCount"

long GetQueueCount();<br/>
[id(0x00000003), helpstring("method Destroy"

void Destroy();<br/>
};<br/>
<br/>
and the events are as follows<br/>
<br/>
[<br/>
uuid(192B9F3E-DF39-41A5-95E0-0333B061CAB8),<br/>
helpstring("_ISTIEventsEvents Interface"

]<br/>
dispinterface _ISTIEventsEvents {<br/>
properties:<br/>
methods:<br/>
[id(0x00000001), helpstring("method OnSTITradeUpdateMsg"

void OnSTITradeUpdateMsg([in] ISTITradeUpdateMsg* oSTITradeUpdateMsg);<br/>
[id(0x00000002), helpstring("method OnSTIOrderUpdateMsg"

void OnSTIOrderUpdateMsg([in] ISTIOrderUpdateMsg* oSTIOrderUpdateMsg);<br/>
[id(0x00000003), helpstring("method OnSTIOrderRejectMsg"

void OnSTIOrderRejectMsg([in] ISTIOrderRejectMsg* oSTIOrderRejectMsg);<br/>
[id(0x00000004), helpstring("method OnSTIOrderConfirmMsg"

void OnSTIOrderConfirmMsg([in] ISTIOrderConfirmMsg* oSTIOrderConfirmMsg);<br/>
[id(0x00000005), helpstring("method OnSTITradeUpdate"

void OnSTITradeUpdate([in] structSTITradeUpdate* structTradeUpdate);<br/>
[id(0x00000006), helpstring("method OnSTIOrderUpdate"

void OnSTIOrderUpdate([in] structSTIOrderUpdate* structOrderUpdate);<br/>
[id(0x00000007), helpstring("method OnSTIOrderReject"

void OnSTIOrderReject([in] structSTIOrderReject* structOrderReject);<br/>
[id(0x00000008), helpstring("method OnSTIOrderConfirm"

void OnSTIOrderConfirm([in] structSTIOrderConfirm* structOrderConfirm);<br/>
[id(0x00000009), helpstring("method OnSTIShutdownStruct"

HRESULT OnSTIShutdown();<br/>
[id(0x0000000a), helpstring("method OnSTILinkSymChange"

void OnSTILinkSymChange([in] structSTILink* structLink);<br/>
[id(0x0000000b), helpstring("method OnSTIDrop"

void OnSTIDrop([in] structSTIDrop* structDrop);<br/>
[id(0x0000000c), helpstring("method OnSTITradeUpdateXML"

HRESULT OnSTITradeUpdateXML([in] BSTR* bstrTrade);<br/>
[id(0x0000000d), helpstring("method OnSTIOrderUpdateXML"

HRESULT OnSTIOrderUpdateXML([in] BSTR* bstrOrder);<br/>
[id(0x0000000e), helpstring("method OnSTIOrderRejectXML"

HRESULT OnSTIOrderRejectXML([in] BSTR* bstrOrder);<br/>
[id(0x0000000f), helpstring("method OnSTIOrderConfirmXML"

HRESULT OnSTIOrderConfirmXML([in] BSTR* bstrOrder);<br/>
};<br/>
<br/>
I only want to use the last event which is<br/>
<br/>
HRESULT OnSTIOrderConfirmXML([in] BSTR* bstrOrder);<br/>
<br/>
is it possible to use only one event and ignore the others ? and how would I subscribe to it ? Any suggestions would be appreciated<br/>
<br/>
<br/>
<
A candle loses nothing by lighting another candle.
View the full article