Solved

Webcam Livestreaming On MFC

Posted on 2004-04-17
9
11,980 Views
Last Modified: 2013-11-20
Has anyone done a program that obtain images from webcam ?
Or does anyone know how to do it ? i need to write a c++ application that can connect to a webcam and then show the images from the webcam on the viewing area of the program. anyone who has information or can direct me to the place with the appropriate solution for my problem...
0
Comment
Question by:itsharis999
  • 4
  • 4
9 Comments
 
LVL 4

Expert Comment

by:bkfirebird
ID: 10851543
you should use directx to capture video .... its pretty easy to use .... and there is a very good directshow example with source code which does that
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 10851957
This is surprisingly easy:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_using_video_capture.asp

Go step-by-step and you can can get results in a few minutes.
You can use also CapTest MSDN sample. It contains a lot of code, but 90% of it is building of user-interface using API. Webcam-related stuff is simple.
0
 

Author Comment

by:itsharis999
ID: 10852886
Thanks for your comment Alex, but can u tell me one more thing, that from where i can download this CapTest MSDN Sample. and how can i integrate that in my own program... kindly help me... its urgent..
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10852906
Just type CapTest in the MSDN Library index. MSDN article "CapTest: AVICap Capture Window Class" contains download link.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 48

Expert Comment

by:AlexFM
ID: 10852907
I don't think you can integrate this sample into your own program. It contains a lot of code, most of it is not related to video capturing. But you can use it as reference.
Using link from my first post you can do this without problems.
0
 

Author Comment

by:itsharis999
ID: 10852931
Thanks for your comment Alex, but can u tell me one more thing, that from where i can download this CapTest MSDN Sample. and how can i integrate that in my own program... kindly help me... its urgent...
0
 

Author Comment

by:itsharis999
ID: 10852970
The link you specified in your first ever comment have got some steps for capturing video. if i put the same code in the MFC class then will it work for me or i have to do something else, as there is no proper way written that how to use those samples in my own application... waiting for ur response...

.har!s.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10853008
Suppose you have MFC dialog-based application. Add member:

HWND m_hCaptureWnd;

to the dialog class.

To connect to first available capture driver write:

    CAPSTATUS CapStatus;
    capDriverConnect(m_hCaptureWnd, 0);

Creating of capture window:

    m_hCaptureWnd = capCreateCaptureWindow(
        _T(""),
        WS_CHILD,
        0,
        0,
        CapStatus.uiImageWidth,
        CapStatus.uiImageHeight,
        m_hWnd,
        ID_CAPTURE_WND);

To set preview rate and start preview write:

    capPreviewRate(m_hCaptureWnd, 100);
    capPreview(m_hCaptureWnd, TRUE);'
0
 

Author Comment

by:itsharis999
ID: 10853141
Nothing is working for me, it is still giving too many errors too handle... im really new in MFC Windows Programming and it is scaring me alot... Can you email me any specific program's source-code or any of your self-made program that do just this function, like showing the stream from cam on the MFC interface...? or just provide me the link to it...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
string initialization in java 11 109
java ^ examples 8 62
Problem to open Excel file 15 95
Making an alias 7 79
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now