VS2005 IDE problem with dispatch map in mfc ocx project

G

Gwarg

Hello

I hope someone has encountered this and knows what the problem is. I've
taken over an mfc ocx project and i am normally not an mfc programmer.
I was trying to change settings to allow me to save the ocx in another
name. While i was trying to do this something went wrong and the
project started giving complie errors on the dispatch map. I have made
no changes what so ever to the code or any project files. I even
reverted all the files to an old version from the source safe and the
errors are still there. From that i would have to conclude that there
is some kind of setting that i managed to change that persists onto all
projects. The only place i think i was messing around in was the
project properties though.

Any help would be greatly appreciated.

errors on 2nd to last row:
error C2146: syntax error : missing '}' before identifier 'VT_BOOL'
error C2146: syntax error : missing '}' before identifier 'VT_BOOL'
error C2146: syntax error : missing ';' before identifier 'VT_BOOL'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
error C2365: 'VT_BOOL' : redefinition; previous definition was
'enumerator'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-in
error C2365: 'VT_BOOL' : redefinition; previous definition was
'enumerator'
error C2226: syntax error : unexpected type 'AFX_PMSG'
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : '}'

errors on last row:
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : '}'


BEGIN_DISPATCH_MAP(CDummyPOSCtrl, CDummyOleCtrl)
DISP_FUNCTION_ID(CDummyPOSCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox,
VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "ShowSetup", dispidShowSetup,
ShowSetup, VT_BOOL, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartFileTransfer",
dispidStartFileTransfer, StartFileTransfer, VT_BOOL, VTS_BSTR VTS_BOOL)
DISP_FUNCTION_ID(CDummyPOSCtrl, "IsFileTransferTime",
dispidIsFileTransferTime, IsFileTransferTime, VT_BOOL, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartStandAloneSale",
dispidStartStandAloneSale, StartStandAloneSale, VT_BOOL, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartStandAloneObliterate",
dispidStartStandAloneObliterate, StartStandAloneObliterate, VT_BOOL,
VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "GetSaleResult", dispidGetSaleResult,
GetSaleResult, VT_I2, VTS_PI4 VTS_PBSTR VTS_PBSTR VTS_PBSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartObliterate",
dispidStartObliterate, StartObliterate, VT_I2, VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "SetIdNumber", dispidSetIdNumber,
SetIdNumber, VT_I2, VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "SetStore", dispidSetStore, SetStore,
VT_I2, VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "SetSerialNumber",
dispidSetSerialNumber, SetSerialNumber, VT_I2, VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartSaleModal",
dispidStartSaleModal, StartSaleModal, VT_I2, VTS_I4 VTS_BSTR VTS_BSTR
VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartSaleAsynch",
dispidStartSaleAsynch, StartSaleAsynch, VT_I2, VTS_I4 VTS_BSTR VTS_BSTR
VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR
VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "ResetData", dispidResetData,
ResetData, VT_BOOL, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "GetSaleResultPremium",
dispidGetSaleResultPremium, GetSaleResultPremium, VT_I4, VTS_NONE)
DISP_FUNCTION_ID(CDummyPOSCtrl, "GetSaleResultInsuranceNo",
dispidGetSaleResultInsuranceNo, GetSaleResultInsuranceNo, VT_BSTR,
VTS_BOOL)
DISP_FUNCTION_ID(CDummyPOSCtrl, "GetSaleResultEx",
dispidGetSaleResultEx, GetSaleResultEx, VT_I2, VTS_PI4 VTS_PI4
VTS_PBSTR VTS_PBSTR VTS_PBSTR VTS_PBSTR VTS_PBSTR VTS_PBSTR VTS_PBSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "StartSaleModalCust",
dispidStartSaleModalCust, StartSaleModalCust, VT_I2, VTS_I4 VTS_BSTR
VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR
VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR)
DISP_FUNCTION_ID(CDummyPOSCtrl, "Deliver", dispidDeliver, Deliver,
VT_BOOL, VTS_BSTR VT_BOOL)
END_DISPATCH_MAP()



Defines for the dispatch:

#define BEGIN_DISPATCH_MAP(theClass, baseClass) \
const AFX_DISPMAP* theClass::GetDispatchMap() const \
{ return &theClass::dispatchMap; } \
AFX_COMDAT const AFX_DISPMAP theClass::dispatchMap = \
{ &baseClass::dispatchMap, &theClass::_dispatchEntries[0], \
&theClass::_dispatchEntryCount, &theClass::_dwStockPropMask }; \
AFX_COMDAT UINT theClass::_dispatchEntryCount = (UINT)-1; \
AFX_COMDAT DWORD theClass::_dwStockPropMask = (DWORD)-1; \
AFX_COMDAT const AFX_DISPMAP_ENTRY theClass::_dispatchEntries[] = \
{ \


#define END_DISPATCH_MAP() \
{ VTS_NONE, DISPID_UNKNOWN, VTS_NONE, VT_VOID, \
(AFX_PMSG)NULL, (AFX_PMSG)NULL, (size_t)-1, afxDispCustom } }; \


#define DISP_FUNCTION_ID(theClass, szExternalName, dispid, pfnMember,
vtRetVal, vtsParams) \
{ _T(szExternalName), dispid, vtsParams, vtRetVal, \
(AFX_PMSG)(void (theClass::*)(void))&pfnMember, (AFX_PMSG)0, 0, \
afxDispCustom }, \
 
G

Guest

Gwarg,

I think you have a parameter problem on this line:

DISP_FUNCTION_ID(CDummyPOSCtrl, "Deliver", dispidDeliver, Deliver,
VT_BOOL, VTS_BSTR VT_BOOL

VT_ values are used for return type, VTS_ values are used for parameter
definitions. The last VT_BOOL is a problem because it's in the paramter
list, but not a valid parameter type.

Good luck with this,

Kim
 
G

Gwarg

It worked, Much thanks =)

I was sure i had tried reverting all that code back to old code and it
still failed but aparently i failed at the reverting.

Andreas
 
Top