I am trying to embed WMP in a newly created MFC dialog based application using Visual Studio 2019. These are the steps I'm following:
WMP_Player
m_wmp
CWMP_Player.h
and CWMP_Player.cpp
are added to the project.I try to build the project and it fails.
Inside CWMP_Player.h
there are 354 errors like:
Severity Code Description Project File Line Suppression State
Error C2535
BOOL CWMP_Player::get_isAvailable(LPCTSTR)
: member function already defined or declared WinMediaPlError C2377
BOOL
: redefinition; typedef cannot be overloaded with any other symbol WinMediaPlError C2660
CWMP_Player::InvokeHelper
: function does not take 5 arguments WinMediaPl
While the CWMP_Player.cpp
is almost empty, with only a couple of includes (one which is the pch.h
) and just this line:
IMPLEMENT_DYNCREATE(CWMP_Player, CWnd)
Did I forget a step? Should I include something in this file or another?
In my opinion, the code automatically added in the class file added by VS2019 conflicts with the definition in WinMediaPl
. After comparing the code automatically added by VS2017 and VS2019, I find that the automatically added code below is redundant in CWMP_Player.h
or other .h
.
// Operations
public:
// IWMPPlaylist
// Functions
//
long get_count()
{
long result;
InvokeHelper(0xC9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr);
return result;
}
CString get_name()
{
CString result;
InvokeHelper(0xCA, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr);
return result;
}
...
VARIANT getItemInfoByType(long lCollectionIndex, LPCTSTR bstrType, LPCTSTR bstrLanguage, long lAttributeIndex)
{
VARIANT result;
static BYTE parms[] = VTS_I4 VTS_BSTR VTS_BSTR VTS_I4 ;
InvokeHelper(0x5AE, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms, lCollectionIndex, bstrType, bstrLanguage, lAttributeIndex);
return result;
}
So, you could comment them out.