在网上看到一段BCB的代码:
测试神龙卡路数,其中pDecoderFilter要对应不同的设备。
int iDev = 0;
for (int i = 0; i < 10 ; i++)
{
//这里可以判断有几路神龙卡
hr = CoCreateInstance(CLSID_RM_MPEG2_VIDEO_SUBPICTURE, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (LPVOID *) &pDecoderFilter);
if(hr != S_OK)
break;
iDev++;
}
char sMsg[256];
sprintf(sMsg,"%d", iDev);
MessageBox(ghApp, sMsg, "Msg", MB_OK);
用Delphi可以这样写:
var
i, iDev: integer;
hr: HResult;
pDecoderFilter: IBaseFilter;
begin
iDev:=0;
for i := 0 to 10 do
begin
hr := CoCreateInstance(CLSID_RM_MPEG2_VIDEO_SUBPICTURE ,nil,CLSCTX_INPROC_SERVER,IID_IBaseFilter,pDecoderFilter);
if (hr <> S_OK) then break;
inc(iDev);
end;
showmessage(IntToStr(iDev));
//const CLSID_RM_MPEG2_VIDEO_SUBPICTURE : TGUID ='{4E3ABD41-458E-11d1-917e-00001B4F006F}';