🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
1 messages
1 total messages Started by Edward Wed, 03 Dec 2003 02:09
OTHER WAY
#520
Author: Edward
Date: Wed, 03 Dec 2003 02:09
83 lines
2932 bytes
    I have two layers of programs "MY WEBCAMCAP" and "OTHER  PROGRAM WHERE I
SHOW THE VIDEO" first i try capture BMP and make other program read those
BMP after i try to put video direct on program.

        I trying to made a another way to my program work showing the image
direct on the DESKTOP but i have problem of FLICKER using:

       HWND hForm = GetDesktopWindow() ;

Using   HWND hForm = FindWindow("MYPROG",NULL);  doenst work.

ANY IDEIA?

My question is: How to capture video from a webcam without use FORM or
DESKTOP like Handle.






THE CODE





void __fastcall TFormPrincipal::FormCreate(TObject *Sender)
{

  AVICapDllHandle = LoadLibrary( "AVICAP32.DLL" );
  //  HWND hForm = FormPrincipal->Handle;
  HWND hForm = GetDesktopWindow() ;

  ctImg=0;
  FILE *arqSize;
  char strSize[10];
  AnsiString strAnsiSize;

  DeleteFile("SAIR.DAT");
  if(FileExists("SIZE.DAT"))
  {
    if((arqSize=fopen("SIZE.DAT","rt"))==NULL)
    {
      ShowMessage("Erro na abertura do Arquivo SIZE.DAT. Arquivo de
configura��o da WEBCAM!");
      Close();
    }
    fseek(arqSize,  SEEK_SET, 0);
    fgets(strSize, 12, arqSize);
    strAnsiSize = AnsiString(strSize);
    fclose(arqSize);

    tamXVL = strAnsiSize.SubString(1,strAnsiSize.AnsiPos("x")-1).ToInt();
    tamYVL =
strAnsiSize.SubString(strAnsiSize.AnsiPos("x")+1,strAnsiSize.Length()-(strAn
siSize.AnsiPos("x")+1) ).ToInt();
  }
  else
  {
    tamXVL=320;
    tamYVL=240;
  }
  if(AVICapDllHandle == 0)
  {
    MessageBox ( NULL, "LoadLibrary:\nAVICAP32.DLL not found.", "Error FS
002", MB_ICONSTOP );
  }
  hWndC = capCreateCaptureWindow("CamWin", WS_CHILD | WS_VISIBLE, 330, 250,
tamXVL, tamYVL, hForm, 0 );

  if(capDriverConnect(hWndC, 0))
  {
    if(capPreviewRate(hWndC, 100/3))
    {
      capPreviewScale(hWndC, TRUE);
      capPreview(hWndC, TRUE);
    }
  }
  TimerRefresh->Enabled = true;
}
//--------------------------------------------------------------------------
-
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads