Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / August 2006

Tip: Looking for answers? Try searching our database.

VS2005 IDE problem with dispatch map in mfc ocx project

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gwarg - 14 Aug 2006 13:31 GMT
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 }, \
Gwarg - 15 Aug 2006 08:05 GMT
Shameless bump. Anyone out there who have seen this and know what to do?
Kim Greenlee - 17 Aug 2006 00:42 GMT
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

Signature

digipede - Many legs make light work.
Grid computing for the real world.
http://www.digipede.net
http://krgreenlee.blogspot.net

Gwarg - 17 Aug 2006 10:28 GMT
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

> Gwarg,
>
[quoted text clipped - 16 lines]
> http://www.digipede.net
> http://krgreenlee.blogspot.net

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.