Generating the legacy mfc class wrapper files – Echelon LNS User Manual
Page 346

LNS Programmer's Guide
332
lca::lcaEventIdNvMonitorPointEvent,
OnNvMonitorPointEvent,
&OnNvMonitorPointEventInfo)
SINK_ENTRY_INFO(IDC_EVENTS,
lca::DIID__DLcaObjectServerEvents,
lca::lcaEventIdMsgMonitorPointEvent,
OnMsgMonitorPointEvent,
&OnMsgMonitorPointEventInfo)
END_SINK_MAP()
The wrapper function in lcaobjsv.tli provides the necessary fields to fill in the
ATL_FUNC_INFO structure:
#pragma implementation_key(16)
inline HRESULT lca::_DLcaObjectServerEvents::OnNvMonitorPointEvent(
IDispatch * MonitorPoint,
short EventType)
{
HRESULT _result;
_com_dispatch_method(this,
0x13,
DISPATCH_METHOD,
VT_ERROR,
(void*)&_result,
{VT_DISPATCH, VT_I2},
MonitorPoint,
EventType);
return _result;
}
The first 2 parameters will always be CC_STDCALL and VT_EMPTY to indicate the
necessary calling convention and a VOID return type. The 3
rd
parameter specifies number
of parameters the event handler received. For example, in the case of the
OnNvMonitorPointEvent event, the value is 2, for the MonitorPoint and EventType
parameters. Finally, an array of parameter sizes in bytes is listed within {}.
The remaining piece of information necessary from the lcaobjsv.tli file is the DISPID
specified within the implementation_key macro for the event handler wrapper in the
lcaobjsv.tli file. This value is used as the third parameter of the
SINK_ENTRY_INFO macro. The value is also defined within the lcaobjsv.tli file as the
lcaEventIdNvMonitorPointEvent constant.
Finally, the actual event handler declaration for OnNvMonitorPointEvent event would
be:
void __stdcall OnNvMonitorPointEvent(LPDISPATCH MonitorPoint,
short EventType)
{
}
Generating the Legacy MFC Class Wrapper Files
This section describes how to generate the lcaobjsv.h, lcaobjsv3.h, and
lcaobjsv.cpp files using Microsoft Visual C++ 6.0. To do so, follow these steps:
1. Open the Microsoft Visual C++ 6.0 development environment. From the
File menu, select New.