I try translate MS AudioPlay (Windows Media Format sample) to BCB2007, I got
the link error meesage on WMCreateReader when I call CAudioPlay::Init() at
my main unit.
Please tell me what missing on my project?
Thanks for any comments and help.
Best regards
James
The error message:
[ILINK32 Error] Error: Unresolved external 'WMCreateReader' referenced from
D:\VRDRUMMIDI PROJECT\CONVERT\IWMREADER\DEMO2\DEBUG\AUDIOPLAYUNIT.OBJ
The Sample code from MS AudioPlay
#include <wmsdkidl.h>
#include <wmsdk.h>
#include "mmsystem.h"
#include "vcl.h"
#include "WMFTestUnit.h"
//------------------------------------------------------------------------------
// Name: CAudioPlay::Init()
// Desc: Initializes the audio player.
//------------------------------------------------------------------------------
HRESULT CAudioPlay::Init()
{
HRESULT hr = S_OK;
TCHAR tszErrMsg[ 256 ];
do
{
hr = CoInitialize( NULL );
if( FAILED( hr ) )
{
//(void)StringCchCopy( tszErrMsg, ARRAYSIZE(tszErrMsg), _T( "CoInitialize
failed" ) );
ShowMessage("CoInitialize failed");
break;
}
// Create an event for asynchronous calls.
// When code in this class makes a call to an asynchronous
// method, it will wait for the event to be set to resume
// processing.
m_hAsyncEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
if( NULL == m_hAsyncEvent )
{
//(void)StringCchCopy( tszErrMsg, ARRAYSIZE(tszErrMsg), _T( "Could not
create the event" ) );
ShowMessage("Could not create the event");
hr = E_FAIL;
break;
}
// Create a reader object, requesting only playback rights.
hr = WMCreateReader( NULL, WMT_RIGHT_PLAYBACK, &m_pReader );
if( FAILED( hr ) )
{
ShowMessage("Could not create Reader");
break;
}
}
while( FALSE );
if( FAILED( hr ) )
{
ShowMessage("Error");
Exit();
}
return( hr );
}
You miss import library for all windows media API functions (wmvcore.lib).
However CodeGear does not ship this library with their products.
To generate one yourself go to command line and execute this command:
implib -c -f wmvcore.lib %SYSTEMROOT%\System32\wmvcore.dll
Then add this lib file to your project.
> However CodeGear does not ship this library with their products.
>
> To generate one yourself go to command line and execute this command:
>
> implib -c -f wmvcore.lib %SYSTEMROOT%\System32\wmvcore.dll
>
> Then add this lib file to your project.
>
Can I free use these dll in my project?
Thanks for any comments
Best regards,
James
wmvcore.dll is part of the system. It comes preinstalled as part of
windows media player. So you just need to make sure that user machine
has istalled windows media player 7 or more recent version.
What you use in your project to compile it is import lib file
(wmvcore.lib) and of course that one you can freely use.