全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1150
推到 Plurk!
推到 Facebook!

請問使用 DSPack 顯示 PropertyPage 方法

尚未結案
bearmaster
一般會員


發表:36
回覆:45
積分:16
註冊:2004-05-27

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-10-13 14:28:41 IP:210.208.xxx.xxx 未訂閱
我是安裝 BCB6, DX9 及 DSPack234, 參考了 BCB6\Playcap 程式, 編譯過後的結果都 OK, 執行也正常, 但我想加入更改 resolution 的 menu item, 所以嘗試叫出 PropertyPage 來選擇 resolution. 可是現在只能顯示出 ppDefault PropertyPage, 無法顯示其他的 prooerty page,  請問各位大大, 是否我有遺漏什麼程序?    
//---------------------------------------------------------------------------
#include 
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DSPack"
#pragma resource "*.dfm"    TForm1      *Form1;
TSysDevEnum *SysDev;
ICaptureGraphBuilder2   *Graph = NULL;
IBaseFilter             *SourceFilter = NULL;
IBaseFilter             *VideoFilter = NULL;    //---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}    //---------------------------------------------------------------------------    void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
    Graph->Release();
    VideoFilter->Release();
    SourceFilter->Release();
}
//---------------------------------------------------------------------------    void __fastcall TForm1::FormCreate(TObject *Sender)
{
    SysDev = new TSysDevEnum(AM_KSCATEGORY_CAPTURE); //CLSID_VideoInputDeviceCategory        if (SysDev->CountFilters > 0)
    {
        TMenuItem   *Device;
        for(int i=0; iCountFilters; i  )
        {
            Device = new TMenuItem(Devices);
            Device->Caption = SysDev->Filters[i].FriendlyName;
            Device->Tag = i;
            Device->OnClick = Devices1Click;
            ShowMessage(SysDev->Filters[i].FriendlyName);
            Devices1->Add(Device);
        }
    }
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Devices1Click(TObject *Sender)
{
    FilterGraph->ClearGraph();
    FilterGraph->Active = false;
    Filter->BaseFilter->Moniker = SysDev->GetMoniker(((TMenuItem *)Sender)->Tag);
    Filter->BaseFilter->Moniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void **)&SourceFilter);
    FilterGraph->Active = true;        CheckDSError(FilterGraph->QueryInterface(IID_ICaptureGraphBuilder2, &Graph));
    CheckDSError(VideoWindow->QueryInterface(IID_IBaseFilter, &VideoFilter));
    CheckDSError(Filter->QueryInterface(IID_IBaseFilter, &SourceFilter));        Graph->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, SourceFilter, NULL, VideoFilter);//PIN_CATEGORY_CAPTURE        FilterGraph->Play();
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button1Click(TObject *Sender)
{
    if (HaveFilterPropertyPage(SourceFilter, ppDefault))        ShowMessage("have ppDefault");
    if (HaveFilterPropertyPage(SourceFilter, ppVFWCapFormat))   ShowMessage("have ppVFWCapFormat");
    if (HaveFilterPropertyPage(SourceFilter, ppVFWCapSource))   ShowMessage("have ppVFWCapSource");
    if (HaveFilterPropertyPage(SourceFilter, ppVFWCapDisplay))  ShowMessage("have ppVFWCapDisplay");
    if (HaveFilterPropertyPage(SourceFilter, ppVFWCompConfig))  ShowMessage("have ppVFWCompConfig");
    if (HaveFilterPropertyPage(SourceFilter, ppVFWCompAbout))   ShowMessage("have ppVFWCompAbout");
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button2Click(TObject *Sender)
{
    HRESULT     hr;
    IAMCrossbar *pXBar1=NULL;        hr=Graph->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, SourceFilter, IID_IAMCrossbar, (VOID **)&pXBar1);        if (SUCCEEDED(hr))
    {
        ShowMessage("have IID_IAMCrossbar interface");
//        DisplayCrossbarInfo(pXBar1);
        pXBar1->Release();
    }
    else    ShowMessage("non IID_IAMCrossbar interface");
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button3Click(TObject *Sender)
{
    IAMVfwCaptureDialogs    *pVfw=NULL;
    HRESULT                 hr;        hr=SourceFilter->QueryInterface(IID_IAMVfwCaptureDialogs, (void **)&pVfw);        if (SUCCEEDED(hr))
    {
        ShowMessage("have IID_IAMVfwCaptureDialogs interface");
        ShowFilterPropertyPage((unsigned int)Form1->Handle, SourceFilter, ppVFWCapFormat);            if (S_OK==pVfw->HasDialog(VfwCaptureDialog_Source))
        {
                ShowMessage("have VfwCaptureDialog_Source");
        }
        else    ShowMessage("non VfwCaptureDialog_Source");
    }
    else    ShowMessage("non IID_IAMVfwCaptureDialogs interface");
}
//---------------------------------------------------------------------------    
在 Button1Click 裡, 是用來判斷是否有 PropertyPage. 在 Button2Click, Button3Click 裡, 原本是想參考 http://delphi.ktop.com.tw/topic.php?topic_id=35690 討論, 但在 Graph->FindInterface 都回傳 fail. 我嘗試了 CLSID_VideoInputDeviceCategory Filter 及 AM_KSCATEGORY_CAPTURE Filter 都是相同的結果
系統時間:2024-11-25 22:29:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!