CoInitialize(NULL);
LONGLONG duration=0;
cstring convert;///需要播放的文件
IGraphBuilder* pshow;
IMediaSeeking* pMS;
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,(void**)&pshow);
pshow->QueryInterface(IID_IMediaSeeking,(void**)&pMS);
pshow->RenderFile(convert.AllocSysString(),NULL);
if(!pMS) return ;
if(S_OK != pMS->IsFormatSupported(&TIME_FORMAT_MEDIA_TIME))
return ;
GUID guidOFormat;
if(FAILED(pMS->GetTimeFormat(&guidOFormat)))
return ;
if(FAILED(pMS->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME)))
return ;
if(FAILED(pMS->GetDuration(&duration)))
return ;
if(guidOFormat != TIME_FORMAT_MEDIA_TIME)
{
if(FAILED(pMS->SetTimeFormat(&guidOFormat);))
return ;
}
pMS->Release();
pshow->Release();
CoUninitialize();
LONGLONG duration=0;
cstring convert;///需要播放的文件
IGraphBuilder* pshow;
IMediaSeeking* pMS;
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,(void**)&pshow);
pshow->QueryInterface(IID_IMediaSeeking,(void**)&pMS);
pshow->RenderFile(convert.AllocSysString(),NULL);
if(!pMS) return ;
if(S_OK != pMS->IsFormatSupported(&TIME_FORMAT_MEDIA_TIME))
return ;
GUID guidOFormat;
if(FAILED(pMS->GetTimeFormat(&guidOFormat)))
return ;
if(FAILED(pMS->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME)))
return ;
if(FAILED(pMS->GetDuration(&duration)))
return ;
if(guidOFormat != TIME_FORMAT_MEDIA_TIME)
{
if(FAILED(pMS->SetTimeFormat(&guidOFormat);))
return ;
}
pMS->Release();
pshow->Release();
CoUninitialize();









