|
extern __declspec(dllexport) void __fastcall ReSetForm(void)
{
AnsiString TS;
float FramesPerSec = 50.0;
int nID=-1;
char lpszName[80];
char lpszVer[80];
lpszName[0]='\0';
lpszVer[0]='\0';
for (int i=0;i<=9;i++)
if (capGetDriverDescription( i, lpszName, sizeof(lpszName), lpszVer, sizeof(lpszVer)))
{
nID=i;
TS="";
TS=TS+IntToStr(nID)+": "+lpszName+", "+lpszVer;
Form1->ComboBox1->Items->Add(TS);
}
if (nID==-1)
{
ShowMessage("!!");
exit(-1);
}
else
{
Form1->ComboBox1->ItemIndex=0;
nID=StrToInt(Form1->ComboBox1->Items->Strings[0].c_str()[0]);
Form1->ComboBox1->Hint=Form1->ComboBox1->Items->Strings[0];
}
Form1->Panel1->Width=166;
Form1->Panel1->Height=126;
Form1->Image1->Picture=0;
Form1->Image1->Width=160;
Form1->Image1->Height=120;
Form1->Image1->Left=3;
Form1->Image1->Top=3;
Form1->Image2->Width=160;
Form1->Image2->Height=120;
Form1->Image2->Left=3;
Form1->Image2->Top=3;
Form1->Image3->Width=160;
Form1->Image3->Height=120;
Form1->Image3->Left=3;
Form1->Image3->Top=3;
Form1->Panel2->Width=166;
Form1->Panel2->Height=126;
Form1->Panel2->Left=Form1->Panel1->Left+Form1->Panel1->Width;
Form1->ClientHeight=Form1->Panel1->Height+/*Panel3->Height+*/Form1->Panel4->Height+Form1->Panel5->Height+Form1->ProgressBar1->Height;
Form1->ClientWidth=2*Form1->Panel1->Width;
Form1->SpeedButton6->Enabled=false;
Form1->SpeedButton5->Enabled=false;
Form1->SpeedButton2->Enabled=false;
hWndC1 = capCreateCaptureWindow ( (LPSTR) "My Capture Window",
WS_CHILD | WS_VISIBLE,
3, 3, 160, 120,
Form1->Panel1->Handle,
(int) nID );
bool fOK1=false;
BITMAPINFO myBITMAPINFO1;
CAPSTATUS CapStatus1;
fOK1 = capDriverConnect(hWndC1, 0);
if (fOK1)
{
capGetVideoFormat(hWndC1,&myBITMAPINFO1,sizeof(myBITMAPINFO1));
myBITMAPINFO1.bmiHeader.biWidth=160;
myBITMAPINFO1.bmiHeader.biHeight=120;
myBITMAPINFO1.bmiHeader.biBitCount=24;
myBITMAPINFO1.bmiHeader.biSizeImage=3*160*120;
capSetVideoFormat(hWndC1,&myBITMAPINFO1,sizeof(myBITMAPINFO1));
capGetStatus(hWndC1, &CapStatus1, sizeof (CAPSTATUS));
SetWindowPos(hWndC1, NULL, 0, 0, CapStatus1.uiImageWidth,
CapStatus1.uiImageHeight, SWP_NOZORDER | SWP_NOMOVE);
capPreviewRate(hWndC1, 1.0e3/FramesPerSec);
capPreview(hWndC1, TRUE);
}else ShowMessage("!!");
}
//---------------------------------------------------------------------------
여기까지가 dll입니다..
void __fastcall TForm1::FormCreate(TObject *Sender)
{
HINSTANCE DLLInstSetForm;
DLLInstSetForm = LoadLibrary("Project1.dll"); // dll화일을 읽는다
if( DLLInstSetForm ) {
(void(__fastcall *)(void))GetProcAddress(DLLInstSetForm, "ReSetForm");
}
}
//---------------------------------------------------------------------------
dll 호출하는 부분이구요..
정말 답답해서 이렇게 올립니다.. 뭐든 답변 부탁드립니다.. 아예
void __fastcall TForm1::FormCreate(TObject *Sender){..}부분을 실행하지 않는거 같습니다..
휴융~~~
감사합니다..
|