Update:
When I restart the PC it works at first start, but after that it's black screen again.
And the solution:
In your camera connect procedure you have to add the following lines:
procedure TFsettings.BstartClick(Sender: TObject);
var
FDriverCaps: TCapDriverCaps;
begin
if not(IsCameraConnected)then
begin
Camera := TFmainpg.Create(Self);
Camera.FHandle := @FHandle;
FHandle := capCreateCaptureWindowA(nil, WS_CHILDWINDOW or WS_VISIBLE or WS_CLIPCHILDREN or WS_CLIPSIBLINGS , Fmainpg.TCamera.Left+ 0, Fmainpg.TCamera.Top- 0, Fmainpg.TCamera.Width- 10, Fmainpg.TCamera.Height-10, Fmainpg.TCamera.Handle, 0);
Sleep(1000);
AVICapSM(Fhandle, WM_CAP_DRIVER_CONNECT,0,0);
//Other stuffs from here
When you stop the camera you have to add the following lines:
AVICapSM(Fhandle, WM_CAP_STOP,0,0);
AVICapSM(Fhandle, WM_CAP_DRIVER_DISCONNECT,0,0);
The windows is still pop up but it's working after you press OK.
Some Edit:
After you stopped the camera and want to restart it the window stays black.
Just simply change:
WS_CHILDWINDOW or WS_VISIBLE or WS_CLIPCHILDREN or WS_CLIPSIBLINGS
to
I'll try to remove that too, and update this post.
Regards,
Sty