描述:
在VB中事件可以是如下代码,EventInfo直接可以按EventInfo.ReturnValue使用:
Private Sub Spreadsheet1_BeforeCommand(ByVal EventInfo As OWC.SpreadsheetEventInfo)
If EventInfo.Command = Spreadsheet1.Constants.ssCalculate Then
EventInfo.ReturnValue = False
End If
End Sub
但在VC中怎样怎样处理?即怎样得到如EventInfo->ReturnValue的设置处理
void CTest1Dlg::OnStartEditSpreadsheet1(LPDISPATCH EventInfo)
{
// TODO: Add your control notification handler code here
}
解决方案1:
The COleDispatchDriver class implements the client side of OLE automation. OLE dispatch interfaces provide access to an object's methods and properties. Member functions of COleDispatchDriver attach, detach, create, and release a dispatch connection of type IDispatch. Other member functions use variable argument lists to simplify calling IDispatch::Invoke.
MFC Library Reference
COleDispatchDriver::COleDispatchDriver
COleDispatchDriver(
LPDISPATCH lpDispatch,
BOOL bAutoRelease = TRUE
);
The form COleDispatchDriver(LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE) connects the IDispatch interface