Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LINK Error when I call Init on WMCreateReader

2 views
Skip to first unread message

James5950

unread,
Apr 9, 2008, 11:29:47 AM4/9/08
to
Hello All,

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 );
}

Darko Miletic

unread,
Apr 9, 2008, 12:14:36 PM4/9/08
to
James5950 wrote:
> Hello All,
>
> 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.
>

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.

James5950

unread,
Apr 9, 2008, 12:49:02 PM4/9/08
to
Thanks Darko

> 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

Darko Miletic

unread,
Apr 9, 2008, 1:49:14 PM4/9/08
to
James5950 wrote:
> Thanks Darko
>
>> 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?

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.

0 new messages