CodePudding user response:
No photos procedure call camera can achieve preview isCodePudding user response:
Why nobodyCodePudding user response:
This part of my original debugging, if you open the file is not a image file, not the correct display pictures, check the part of the code you write the file header, may have a problem, really not coming together to see the code,CodePudding user response:
# include & lt; VFW. H>
HWND hWndC ghWndCap;
Void __fastcall TfmGoodsPhotoGet: : sbCheckVideoClick (TObject * Sender)
{
Bool bVFWFlag;
Int iVFWCount;
if(! BCheckVideoEnable)
{//sheath maerial open
HWndC=Panel8 - & gt; Handle;
//create a capture window, which gives priority to handle to the window hWnd
GhWndCap=capCreateCaptureWindow (" the Capture Window, "WS_CHILD | WS_VISIBLE,
0,0,352,298, hWndC, 0);
BVFWFlag=false;
IVFWCount=0;
While ((iVFWCount<1000) & amp; & (bVFWFlag==false))
{
BVFWFlag=capDriverConnect (ghWndCap, 0);
IVFWCount++;
}
If (bVFWFlag==true)
{
CAPDRIVERCAPS caps.
CapDriverGetCaps (ghWndCap, sizeof (caps), & amp; Caps);
If (caps. FHasOverlay) capOverlay (ghWndCap, TRUE);
CapPreviewScale (ghWndCap, 1);
CapPreviewRate (ghWndCap, 1000/24);//set the Preview mode of display rate
CapPreview (ghWndCap, TRUE);//start the Preview mode
BCheckVideoEnable=true;
SbCheckVideo - & gt; Caption="sheath maerial off";
SbCapture - & gt; Enabled=true;
}
}
The else
{//sheath maerial closed
If (ghWndCap)
{
CapPreview (ghWndCap, false);
CapCaptureStop (ghWndCap);
CapCaptureAbort (ghWndCap);
CapDriverDisconnect (ghWndCap);
: : DestroyWindow (ghWndCap);
GhWndCap=NULL;
BCheckVideoEnable=false;
SbCheckVideo - & gt; Caption="open sheath maerial";
SbCapture - & gt; Enabled=false;
}
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CodePudding user response:
The front is previewCapture the following
[code=c
# include & lt; VFW. H>
HWND hWndC ghWndCap;
Void __fastcall TfmGoodsPhotoGet: : sbCheckVideoClick (TObject * Sender)
{
Bool bVFWFlag;
Int iVFWCount;
if(! BCheckVideoEnable)
{//sheath maerial open
HWndC=Panel8 - & gt; Handle;
//create a capture window, which gives priority to handle to the window hWnd
GhWndCap=capCreateCaptureWindow (" the Capture Window, "WS_CHILD | WS_VISIBLE,
0,0,352,298, hWndC, 0);
BVFWFlag=false;
IVFWCount=0;
While ((iVFWCount<1000) & amp; & (bVFWFlag==false))
{
BVFWFlag=capDriverConnect (ghWndCap, 0);
IVFWCount++;
}
If (bVFWFlag==true)
{
CAPDRIVERCAPS caps.
CapDriverGetCaps (ghWndCap, sizeof (caps), & amp; Caps);
If (caps. FHasOverlay) capOverlay (ghWndCap, TRUE);
CapPreviewScale (ghWndCap, 1);
CapPreviewRate (ghWndCap, 1000/24);//set the Preview mode of display rate
CapPreview (ghWndCap, TRUE);//start the Preview mode
BCheckVideoEnable=true;
SbCheckVideo - & gt; Caption="sheath maerial off";
SbCapture - & gt; Enabled=true;
}
}
The else
{//sheath maerial closed
If (ghWndCap)
{
CapPreview (ghWndCap, false);
CapCaptureStop (ghWndCap);
CapCaptureAbort (ghWndCap);
CapDriverDisconnect (ghWndCap);
: : DestroyWindow (ghWndCap);
GhWndCap=NULL;
BCheckVideoEnable=false;
SbCheckVideo - & gt; Caption="open sheath maerial";
SbCapture - & gt; Enabled=false;
}
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
] [/code]
CodePudding user response: