Using Delphi programming to control the camera

Source: Internet
Author: User

Does your computer have a webcam? See others use QQ to play video screen you will not think how to achieve? Here, the use of Delphi using Ms AVICAP32.DLL can easily realize the camera programming, if coupled with your network programming level, to achieve a video chat is not a problem.

Look at the code in the following code:

Const Wm_cap_start = wm_user;
Const WM_CAP_STOP = Wm_cap_start + 68;
Const WM_CAP_DRIVER_CONNECT = Wm_cap_start + 10;
Const WM_CAP_DRIVER_DISCONNECT = Wm_cap_start + 11;
Const WM_CAP_SAVEDIB = Wm_cap_start + 25;
Const WM_CAP_GRAB_FRAME = Wm_cap_start + 60;
Const Wm_cap_sequence = Wm_cap_start + 62;
Const WM_CAP_FILE_SET_CAPTURE_FILEA = Wm_cap_start + 20;
Const Wm_cap_sequence_nofile =wm_cap_start+
Const wm_cap_set_overlay =wm_cap_start+ '
Const wm_cap_set_ PREVIEW =wm_cap_start+
Const Wm_cap_set_callback_videostream = Wm_cap_start +6;
Const Wm_cap_set_callback_error=wm_cap_start +2;
Const wm_cap_set_callback_statusa= Wm_cap_start +3;
Const wm_cap_set_callback_frame= Wm_cap_start +5;
Const wm_cap_set_scale=wm_cap_start+
Const wm_cap_set_previewrate=wm_cap_start+
function Capcreatecapturewindowa (Lpszwindowname:pchar; dwstyle:longint; x:integer;
Y:integer;nwidth:integer;nheight:integer; Parentwin:hwnd;
Nid:integer): HWND; StdCall EXTERNAL ' AVICAP32. DLL ';

The code above is the definition of a function and a constant that we use primarily.

Well, open your Delphi, create a new project, and add the above definition.

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.