private static void Disconnect() { if (useAvicap) { if (hWnd != IntPtr.Zero) SendMessage(hWnd, WM_CAP_DISCONNECT, hWnd.ToInt32(), 0); hWnd = IntPtr.Zero; } else { if (null != cam) cam.Dispose(); cam = null; } connected = false; }
private static void CamThread() { cam = new Capture(); while (connected) { if (timer.Enabled) bitmap = new System.Drawing.Bitmap(cam.Width, cam.Height, cam.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, cam.GetBitMap()); Thread.Sleep(1); } }