Using MS Office Spreadsheet ActiveX Control
-
Hello, First off, let me say that I'm fairly new to ActiveX controls, so I'm probably missing something obvious, but here's the situation. I'm trying to use the Microsoft Office Spreadsheet 11.0 control in a dialog application. I've gone through all of the steps to get the class added to my project. I found the control in the Registered ActiveX Controls folder and selected it, I left the default classes selected and it appeared to create all of the wrapper classes without any major hiccups. The problem comes when I try to compile the program. I get many errors (around 35) which read: error C2440: 'type cast' : cannot convert from 'struct IDispatch *' to 'class CSpreadsheet' No constructor could take the source type, or constructor overload resolution was ambiguous The errors occur in various classes, but invariably the function causing the error has this structure:
CSpreadsheet CXmlMaps::GetApplication() { LPDISPATCH pDispatch; InvokeHelper(0x60020004, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL); return CSpreadsheet(pDispatch); }
The problem seems to be calling the CSpreadsheet (one of the wrapper classes created by the ActiveX wizard) constructor, but CSpreadsheet doesn't appear to have any constructors defined. It's derived from CWnd, so I don't think there are any suitable constructors there either. I've been able to successfully use some of the simpler ActiveX controls (such as the Calendar control), but it seems to hang up on this one for some reason. Any insight would be helpful. I hope I've explained it well enough. Thanks! JD