From my object browser in Visual Studio I can read this:
public virtual event
which is part of the file C:\Program Files (x86)\PIPC\Procbook\PublicAssemblies\OSIsoft.PBSymLib.dll, so just add a reference to that and you'll be on your way.
Thanks for the help
I can't use this delegate because the control is being developed using C++ (unmanaged). But, if I create an event with this delegate, will PB trigger it?
I created an event using COM API and I can attach event handlers to it using PB's VBA, but it is not triggered by PB.
What I really want is: when the PB updates the display's data, updade my control's data too.
In my C# RegressionLine Addin I'm subscribing to ContextChanged events from ProcessBook, and that works flawlessly, so I don't see any obstacles with symbols and data updates.
It's been a while since I used C++ so I can't really give any recommendations or experiences there.
For another addin I had to create quickly I just added a value symbol to my display, set the Visible property to false, hooked on to the data update event using VBA, and relayed the updated value to my addin from there.
I found a solution for my problem. The site support.microsoft.com/.../en-us shows how to create a sink class which can be used as an event handler.
To work with Display's DataUpdate event, the user must create a class like the one demonstred on the link above but with a few changes like create the dispatch function with ID 11 (DataUpdate DISPID) and call AfxConnectionAdvise using the display as source with PBObjLib::EDisplay interface ID.
The following code is the changes that I made to work with PB:
BEGIN_DISPATCH_MAP(CDisplayEventsImpl, CCmdTarget) DISP_FUNCTION_ID(CDisplayEventsImpl, "DataUpdate", 11, UpdateControlData, VT_EMPTY, VTS_NONE) END_DISPATCH_MAP()
BEGIN_INTERFACE_MAP(CDisplayEventsImpl, CCmdTarget) INTERFACE_PART(CDisplayEventsImpl, __uuidof(PBObjLib::EDisplay), Dispatch) END_INTERFACE_MAP()
AfxConnectionAdvise(this->display, __uuidof(PBObjLib::EDisplay), this->displayEvents->GetIDispatch(FALSE), FALSE, &this->cookie);