}
else
{
// Free the format block when you are done:
FreeMediaType(mt);
return VFW_E_INVALIDMEDIATYPE; // Something went wrong
// pVih->bmiHeader is the BITMAPINFOHEADER for the frame.
}
SetDIBitsToDevice(
hdc,0,0,
pVih->bmiHeader.biWidth,
pVih->bmiHeader.biHeight,
0,0,
0,
pVih->bmiHeader.biHeight,
pBuffer,
(BITMAPINFO*)&pVih->bmiHeader,
DIB_RGB_COLORS
);
FreeMediaType(mt);
return hr;
if (mFilterGraph->Create())
{mFilterGraph->CreateSampleGrabber();
mFilterGraph->CompleteBuildGraph(mSourceFile);
mFilterGraph->SpecifyMediaType();
mFilterGraph->RenderFile(mSourceFile);
// Set video window and notification window
mFilterGraph->SetDisplayWindow(mVideoWindow.GetSafeHwnd());
mFilterGraph->SetNotifyWindow(this->GetSafeHwnd());
// Show the first frame
mFilterGraph->Pause();
}
}
void CSimplePlayerDlg::OnButtonGrab()
{
if (mFilterGraph)
{
// Firstly grab a bitmap to a temp file
char szTemp[] = "C:\\mysnapshot.bmp";
//mFilterGraph-> RunGrabberGraph();
// long szbuffer=mFilterGraph->GetSample(NULL);unsigned
char * buffer=new char [640*480*3];//
if (mFilterGraph->Display(((CStatic *)GetDlgItem(IDC_STATIC_1))->GetDC()->m_hDC));//,buffer
{