<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Capture von webcam]]></title><description><![CDATA[<p>Hat jemand von euch eine Idee, wie man den Index der Webcam bestimmen kann,<br />
bzw. das Aufnahmegerät bestimmen kann (hier auf index = 1 gesetzt)?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;vfw.h&gt;

#define capSendMessage(hWnd, uMsg, wParm, lParam) ((IsWindow(hWnd)) ? SendMessage(hWnd, uMsg, (WPARAM)(wParm), (LPARAM)(lParam)) : 0)
int capWebCam(char *szFile, int nIndex, int nX, int nY)
{
    HWND hWndCap = capCreateCaptureWindow(&quot;CapWebCam&quot;, WS_CHILD, 0, 0, nX, nY, GetDesktopWindow(), 0);
    if(!hWndCap) return FALSE;

    if(!capSendMessage(hWndCap, WM_CAP_DRIVER_CONNECT, nIndex, 0)){
        DestroyWindow(hWndCap); return FALSE;    
    }

    CAPDRIVERCAPS capDriverCaps;
    memset(&amp;capDriverCaps, 0, sizeof(CAPDRIVERCAPS));
    capSendMessage(hWndCap, WM_CAP_DRIVER_GET_CAPS, sizeof(CAPDRIVERCAPS), &amp;capDriverCaps);
    if(!capDriverCaps.fCaptureInitialized){
        DestroyWindow(hWndCap); return FALSE;
    }

    capSendMessage(hWndCap, WM_CAP_SET_SCALE, TRUE, 0);
    capSendMessage(hWndCap, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0);
    capSendMessage(hWndCap, WM_CAP_FILE_SAVEDIB, 0, szFile);
    capSendMessage(hWndCap, WM_CAP_DRIVER_DISCONNECT, 0, 0);
    DestroyWindow(hWndCap);

    return TRUE;
}
</code></pre>
<p>Aufruf:</p>
<pre><code class="language-cpp">if(capWebCam(&quot;webcam.bmp&quot;, 1, 320, 240)){
        MessageBox(HWND_DESKTOP, &quot;Success&quot;, &quot;&quot;, MB_OK);
    }else{
        MessageBox(HWND_DESKTOP, &quot;Failed&quot;, &quot;&quot;, MB_OK);
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/196040/capture-von-webcam</link><generator>RSS for Node</generator><lastBuildDate>Mon, 29 Jun 2026 18:54:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/196040.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Oct 2007 19:58:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Capture von webcam on Wed, 24 Oct 2007 19:58:36 GMT]]></title><description><![CDATA[<p>Hat jemand von euch eine Idee, wie man den Index der Webcam bestimmen kann,<br />
bzw. das Aufnahmegerät bestimmen kann (hier auf index = 1 gesetzt)?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;vfw.h&gt;

#define capSendMessage(hWnd, uMsg, wParm, lParam) ((IsWindow(hWnd)) ? SendMessage(hWnd, uMsg, (WPARAM)(wParm), (LPARAM)(lParam)) : 0)
int capWebCam(char *szFile, int nIndex, int nX, int nY)
{
    HWND hWndCap = capCreateCaptureWindow(&quot;CapWebCam&quot;, WS_CHILD, 0, 0, nX, nY, GetDesktopWindow(), 0);
    if(!hWndCap) return FALSE;

    if(!capSendMessage(hWndCap, WM_CAP_DRIVER_CONNECT, nIndex, 0)){
        DestroyWindow(hWndCap); return FALSE;    
    }

    CAPDRIVERCAPS capDriverCaps;
    memset(&amp;capDriverCaps, 0, sizeof(CAPDRIVERCAPS));
    capSendMessage(hWndCap, WM_CAP_DRIVER_GET_CAPS, sizeof(CAPDRIVERCAPS), &amp;capDriverCaps);
    if(!capDriverCaps.fCaptureInitialized){
        DestroyWindow(hWndCap); return FALSE;
    }

    capSendMessage(hWndCap, WM_CAP_SET_SCALE, TRUE, 0);
    capSendMessage(hWndCap, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0);
    capSendMessage(hWndCap, WM_CAP_FILE_SAVEDIB, 0, szFile);
    capSendMessage(hWndCap, WM_CAP_DRIVER_DISCONNECT, 0, 0);
    DestroyWindow(hWndCap);

    return TRUE;
}
</code></pre>
<p>Aufruf:</p>
<pre><code class="language-cpp">if(capWebCam(&quot;webcam.bmp&quot;, 1, 320, 240)){
        MessageBox(HWND_DESKTOP, &quot;Success&quot;, &quot;&quot;, MB_OK);
    }else{
        MessageBox(HWND_DESKTOP, &quot;Failed&quot;, &quot;&quot;, MB_OK);
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1391491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1391491</guid><dc:creator><![CDATA[Netzy]]></dc:creator><pubDate>Wed, 24 Oct 2007 19:58:36 GMT</pubDate></item><item><title><![CDATA[Reply to Capture von webcam on Thu, 25 Oct 2007 15:46:02 GMT]]></title><description><![CDATA[<p>Die VirtualDub-Leute lesen die Namen der Vfw-Capture-Devices glaube ich direkt irgendwo aus der Registry raus.</p>
<p>Ansonsten:<br />
Index durchprobieren und Namen mit capDriverGetName() besorgen.</p>
<p>Die Capture-Programme die ich kenne, verwenden allerdings allesamt kein Vfw sondern DirectShow.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1391994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1391994</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Thu, 25 Oct 2007 15:46:02 GMT</pubDate></item></channel></rss>