PRB: ActiveX Control's Stock Error Event Uses SCODE ValueLast reviewed: March 13, 1998Article ID: Q182434 |
The information in this article applies to:
SYMPTOMSThe event handler generated by ClassWizard does not get called.
CAUSEThe following is a quotation from the online documentation of COleControl::FireError() function:
The implementation of an OLE control's Stock Error event uses an SCODE value. If your control uses this event, and is intended to be used in Visual Basic 4.0, you will receive errors because the SCODE value is not supported in Visual Basic.When you go into the .odl file of the ActiveX control and change the stock error event from SCODE to LONG as required by Visual Basic, the change works correctly in Visual Basic. However, ClassWizard generates an event handler according to the information it obtains from the .odl file. As a result, the event handler in the test container written in Visual C++ will have a LONG instead of SCODE value.
RESOLUTIONThe following are two possible solutions:
STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Sample Code
// In the .cpp file of the test container: // CMyTestDlg is a test container (a dialog-based application) // written in Visual C++. BEGIN_EVENTSINK_MAP(CMyTestDlg, CDialog) //{{AFX_EVENTSINK_MAP(CMyTestDlg) ON_EVENT(CMyTestDlg, IDC_OLECTRL1CTRL1, -608 /* Error */, OnErrorOlectrl1ctrl1, VTS_I2 VTS_PBSTR VTS_I4 // Change VTS_I4 to VTS_SCODE!!! VTS_BSTR VTS_BSTR VTS_I4 VTS_PBOOL) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() // OnErrorOleCtrl1 is the event handler for the Stock Error event of the // ActiveX control. void CMyTestDlg::OnErrorOleCtrl1( short Number, BSTR FAR* Description, long Scode, // Change LONG to SCODE!!! LPCTSTR Source, LPCTSTR HelpFile, long HelpContext, BOOL FAR* CancelDisplay) { // TODO: Add your control notification handler code here. ... }Copyright, Microsoft Corporation 1998, All Rights Reserved. Contributions by Yeong-Kah Tam, Microsoft Corporation Keywords : MfcOLE Version : WINNT:4.2,5.0 Platform : winnt Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |