請教各為先進 TRect 為什麼在BCB中無法執行呢 //--------------------------------------------------------------------------- #include
#pragma hdrstop #include "Unit1.h"
#include
#include #define CLASSNAME "VideoWindow" //---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
IGraphBuilder *pGraph = NULL;
IMediaControl *pMediaControl = NULL;
IVideoWindow *pVidWin = NULL;
HWND g_hwnd;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender)
{ // Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin); // Build the graph.
pGraph->RenderFile(L"C:\\CAPTURE.AVI", NULL); //Set the video window.
g_hwnd=Form1->Handle;
pVidWin->put_Owner((OAHWND)g_hwnd);
pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS); TRECT grc;<-------------------------------無法執行
grc=Form1->ClientRect;<-------------------無法執行 pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom); // Run the graph.
pMediaControl->Run(); }
//--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender)
{
pVidWin->put_Visible(OAFALSE);
pVidWin->put_Owner(NULL);
pMediaControl->Release();
pVidWin->Release();
pGraph->Release(); }
//---------------------------------------------------------------------------