Windows Media Player 11 SDK Implementing DoRendering (deprecated)
Previous | Next |
Implementing DoRendering (deprecated)
This page documents a feature that may be unavailable in future versions of Windows Media Player and the Windows Media Player SDK.
DoRendering is the method where the sample plug-in finally displays the text data. Whether rendering in windowed mode or windowless mode, the code that ultimately displays the text data is the same. In the sample plug-in generated by the plug-in wizard, the code first creates a bitmap in memory with a white background. The code accesses the data in the input buffer from within a critical section to prevent the data from changing during this operation. The following code from MakeBitmapFromData illustrates this:
// Begin critical section. Lock(); BYTE *pbInputData = NULL; DWORD cbInputLength = 0; // Get the data pointer and the buffer length. if( m_spInputBuffer.p ) { hr = m_spInputBuffer->GetBufferAndLength( &pbInputData, &cbInputLength ); } if ( FAILED( hr ) ) { Unlock(); Return hr; } // Display the data from the stream. ::DrawText( m_hdcMem, ( TCHAR* ) pbInputData, cbInputLength/sizeof( TCHAR ) - 1, &m_rctSrc, DT_VCENTER | DT_CENTER | DT_SINGLELINE ); // End critical section. Unlock();
Once the bitmap exists, the code in DoRendering calls StretchBlt to copy the bitmap into the rendering region.
See Also
Previous | Next |