Article ID: 182434
Article Last Modified on 11/21/2006
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.
// 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: kbctrl kbinprocsvr kbprb KB182434