zenOnInit |
Develop ActiveX elements -> Example: LatchedSwitch -> The methods -> zenOnInit |
Show all Hide all |
This method gets the dispatch drivers of the variables via the dispatch pointer of the dynamic element. With this pointer the variable values are read and written when clicking and drawing the control.
BOOL CLatchedSwitchCtrl::zenOnInit(LPDISPATCH dispElement)
{
m_dElement = IElement(dispElement);
if (m_dElement.GetCountVariable() >= 2)
{
short iIndex = 0;
m_dSwitchVar = IVariable(m_dElement.ItemVariable(COleVariant(iIndex)));
m_dLatchVar = IVariable(m_dElement.ItemVariable(COleVariant(++iIndex)));
}
return TRUE;
}