🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #520

OTHER WAY

#520
From: 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;
}
//--------------------------------------------------------------------------
-
Technical Details
Message-ID: <3fcd460b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10d0fc,aea0c3e742f0bdd,start
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2003-12-02 18:40:12 PST
Reply-To: "Edward" <registrados@via-rs.net>
From: "Edward" <registrados@via-rs.net>
Newsgroups: borland.public.cppbuilder.multimedia
Subject: OTHER WAY
Date: Wed, 3 Dec 2003 00:09:52 -0200
Lines: 86
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 200.198.155.216
Message-ID: <3fcd460b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070417419 200.198.155.216 (2 Dec 2003 18:10:19 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail