. Net is a class used to drive cameras.

Source: Internet
Author: User

This article uses the avicap32.dll library to drive the camera. Supports image capturing and video recording.


Using System;
Using System. Runtime. InteropServices;
Using System. Drawing;
Using System. Drawing. Imaging;

Namespace using System;
Using System. Runtime. InteropServices;
Using System. Drawing;
Using System. Drawing. Imaging;

Namespace PickHead
{
/// <Summary>
/// A class for controlling cameras
/// </Summary>
Public class Pick
{
Private const int WM_USER = 0x400;
Private const int WS_CHILD = 0x40000000;
Private const int WS_VISIBLE = 0x10000000;
Private const int WM_CAP_START = WM_USER;
Private const int WM_CAP_STOP = WM_CAP_START + 68;
Private const int WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
Private const int WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
Private const int WM_CAP_SAVEDIB = WM_CAP_START + 25;
Private const int WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
Private const int WM_CAP_SEQUENCE = WM_CAP_START + 62;
Private const int WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
Private const int WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63;
Private const int WM_CAP_SET_OVERLAY = WM_CAP_START + 51;
Private const int WM_CAP_SET_PREVIEW = WM_CAP_START + 50;
Private const int WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6;
Private const int WM_CAP_SET_CALLBACK_ERROR = WM_CAP_START + 2;
Private const int WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3;
Private const int WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5;
Private const int WM_CAP_SET_SCALE = WM_CAP_START + 53;
Private const int WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52;
Private IntPtr hWndC;
Private bool bStat = false;
  
Private IntPtr mControlPtr;
Private int mWidth;
Private int mHeight;
Private int mLeft;
Private int mTop;
  
/// <Summary>
/// Initialize the camera
/// </Summary>
/// <Param name = "handle"> control handle </param>
/// <Param name = "left"> left margin of start display </param>
/// <Param name = "top"> top margin </param>
/// <Param name = "width"> width </param>
/// <Param name = "height"> length to be displayed </param>
Public Pick (IntPtr handle, int left, int top, int width, int height)
{
MControlPtr = handle;
MWidth = width;
MHeight = height;

There are 3 pages in this news. Currently, there are 3 pages in 1st.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.