Copyright © 2001-2019 MultiMedia Soft

TagsReader.WMA_PictureFrameMemoryFileGet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Obtains a copy in memory of the picture file stored inside a WMA picture frame.

 

For further details about methods related to tags reading refer to the TagsReader object.

For details about the reading of tags see the How to read TAG information in sound files tutorial.

 

 

Syntax

 

[Visual Basic]

control.TagsReader.WMA_PictureFrameMemoryFileGet (

nIndex as Integer,

pBuffer as variant,

nBufferLen as long

) as enumErrorCodes


 

[C++]

short control.TagsReader.WMA_PictureFrameMemoryFileGet (

short nIndex,

const VARIANT FAR& pBuffer,

long nBufferLen

);


 

 

Parameter

Description

 

 

nIndex

Zero-based index of the picture frame. The total number of picture frames available inside the WMA tag can be obtained through a call to the TagsReader.WMA_PictureFrameCountGet method.

pBuffer

Output buffer that, on return from the method call, will contain the picture file data

nBufferLength

Length of the buffer expressed in bytes

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.

 

 

Below you can find a couple of samples that demonstrate how to retrieve a picture and store it inside a memory buffer in Visual Basic 6 and Visual C++ 6:

 

Visual Basic 6

 

Private Sub Command1_Click()

' obtain the size in bytes of the first available picture (having index 0)

Dim nSizeInBytes As Long

ActiveSoundEditor1.TagsReader.WMA_PictureFrameSizeGet 0, nSizeInBytes

if nSizeInBytes = 0 then Exit Sub

 

' allocate the destination buffer

Dim bytImage() As Byte

ReDim bytImage(nSizeInBytes)      

 

' read picture data into the buffer

ActiveSoundEditor1.TagsReader.WMA_PictureFrameMemoryFileGet 0, VarPtr(bytImage(0)), nSizeInBytes      

 

...

use the buffer

...

 

' erase the buffer and free memory

Erase bytImage

End Sub

 

 

Visual C++ 6 with MFC

 

void CReadId3v2Dlg::OnButton1()

{

long nSizeInBytes = 0;

m_editor.TagsReader.WMA_PictureFrameSizeGet (0, &nSizeInBytes);

if (nSizeInBytes == 0)

   return;

 

BYTE *pBuffer = new BYTE[nTagSize];

 

COleVariant var;

var.vt = VT_BYREF | VT_UI1;

var.pbVal = pTagBuffer;

m_editor.TagsReader.WMA_PictureFrameMemoryFileGet (0, var, nSizeInBytes);

 

...

use the buffer

...

 

delete pBuffer;

}