|
Question : passing string to container from Active-X
|
|
I have ole enabled container which has active-x.When i click the GUI of Active-x control, the control inturn should fire event passing a string value to the container.Now i have created the custom event in the active-x control.Now when the event is fired i am able to get the string to the container but only the first charecter i want the entire string.How to get the entire string? listing as follows
Active-x control BEGIN_EVENT_MAP(CFilterCtrl, COleControl) //{{AFX_EVENT_MAP(CFilterCtrl) EVENT_CUSTOM("Group", FireGroup, VTS_BSTR) //}}AFX_EVENT_MAP END_EVENT_MAP()
void FireGroup(BSTR bstrVal) {FireEvent(eventidGroup,EVENT_PARAM(VTS_BSTR),bstrVal);} DECLARE_EVENT_MAP()
//when this control is clicked
COleVariant varVal(group.m_DisplayName); varVal.ChangeType( VT_BSTR ); FireGroup(varVal.bstrVal);
///////// container /////////////// BEGIN_EVENTSINK_MAP(CMISReportView, CFormView) //{{AFX_EVENTSINK_MAP(CEntityView) ON_EVENT(CMISReportView, IDC_FILTERCTRL_GROUP, 10 /* Group */, OnGroup, VTS_BSTR) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP()
afx_msg void OnGroup(BSTR bstrGroup) DECLARE_EVENTSINK_MAP()
void CMISReportView::OnGroup(BSTR bstrGroup) { COleVariant varVal((LPCTSTR)bstrGroup); varVal.ChangeType( VT_BSTR ); MessageBox((char *)varVal.bstrVal);// ONELY THE FIRST CHARACTER IS OBTAINED theApp.m_strGpNames = (LPCTSTR)bstrGroup; }
|
|
Answer : passing string to container from Active-X
|
|
What with what I have given you don't you understand - the answer is there or should be - does it not work?
void CMISReportView::OnGroup(BSTR bstrGroup) { theApp.m_strGpNames = (LPCWSTR)bstrGroup; MessageBox(theApp.m_strGpNames); }
|
|
|
|