Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The canvas control doesn't actually contain the image in this case; it's only used to specify the dimensions and parent of a system-managed window that gets displayed directly on top of the Canvas.</p> <p>To grab the current frame you'll need to capture the contents of this system-managed window. </p> <p>e.g. add this function to the WebCamWFS module:</p> <pre class="lang-vb prettyprint-override"><code>Function CaptureFrame(SourceCanvas As Canvas) As Picture Declare Function GetDC Lib "User32" (HWND As Integer) As Integer Declare Function BitBlt Lib "GDI32" (DCdest As Integer, xDest As Integer, yDest As Integer, nWidth As Integer, _ nHeight As Integer, DCdource As Integer, xSource As Integer, ySource As Integer, rasterOp As Integer) As Boolean Declare Function ReleaseDC Lib "User32" (HWND As Integer, DC As Integer) As Integer Const SRCCOPY = &amp;h00CC0020 Const CAPTUREBLT = &amp;h40000000 Dim hDC, w, h As Integer hDC = GetDC(mWnd) w = SourceCanvas.Width h = SourceCanvas.Height x = SourceCanvas.Left + SourceCanvas.Window.Left y = SourceCanvas.Top + SourceCanvas.Window.Top Dim capture As New Picture(w, h, 24) Call BitBlt(Capture.Graphics.Handle(1), 0, 0, w, h, hDC, 0, 0, SRCCOPY Or CAPTUREBLT) Call ReleaseDC(mWnd, hDC) Return capture End Function </code></pre> <p><s>Use the <a href="http://docs.xojo.com/index.php/RectControl.DrawInto" rel="nofollow">DrawInto</a> method of the Canvas control to copy the image to a <code>Picture</code> object, then save the Picture to a file: </p> <pre><code> Dim mypic As New Picture(TargetCanvas.Width, TargetCanvas.Height, 32) TargetCanvas.Drawinto(mypic.Graphics, 0, 0) Dim saveto As FolderItem = GetSaveFolderItem("", "mypic.jpg") mypic.Save(saveto, Picture.SaveAsJPEG) </code></pre> <p></s></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload