Solved

Webcam Livestreaming On MFC

Posted on 2004-04-17
9
11,964 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Just type CapTest in the MSDN Library index. MSDN article "CapTest: AVICap Capture Window Class" contains download link.

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

12 Experts available now in Live!

Get 1:1 Help Now