16,004,479 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by FearfulSymmetry (Top 3 by date)
FearfulSymmetry
16-Nov-12 11:09am
View
Ok! I will try writing one. Thanks for the advice.
FearfulSymmetry
16-Nov-12 10:52am
View
You are right that I should learn VB.NET or C# but I have no where to learn it. No programming classes are offered at my school and I have searched the net over for help but have found no straight answers. If you know where I can go or have any sources that would help, please share. If not, here is the C# code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Expression.Encoder.Devices;
using WebcamControl;
using System.IO;
using System.Drawing.Imaging;
namespace WPF_Webcam
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
private Webcam webCamCtrl;
public MainWindow()
{
InitializeComponent();
webCamCtrl = new Webcam();
// Bind the Video and Audio device properties of the
// Webcam control to the SelectedValue property of
// the necessary ComboBox.
Binding bndg_1 = new Binding("SelectedValue");
bndg_1.Source = VidDvcsComboBox;
webCamCtrl.SetBinding(Webcam.VideoDeviceProperty, bndg_1);
Binding bndg_2 = new Binding("SelectedValue");
bndg_2.Source = AudDvcsComboBox;
webCamCtrl.SetBinding(Webcam.AudioDeviceProperty, bndg_2);
// Create directory for saving video files.
string vidPath = @"C:\VideoClips";
if (Directory.Exists(vidPath) == false)
{
Directory.CreateDirectory(vidPath);
}
// Create directory for saving image files.
string imgPath = @"C:\WebcamSnapshots";
if (Directory.Exists(imgPath) == false)
{
Directory.CreateDirectory(imgPath);
}
// Set some properties of the Webcam control
webCamCtrl.VideoDirectory = vidPath;
webCamCtrl.VidFormat = VideoFormat.wmv;
webCamCtrl.ImageDirectory = imgPath;
webCamCtrl.PictureFormat = ImageFormat.Jpeg;
// Set the Webcam control as the ContentControl's content.
ContentControl1.Content = webCamCtrl;
// Find a/v devices connected to the machine.
FindDevices();
VidDvcsComboBox.SelectedIndex = 0;
AudDvcsComboBox.SelectedIndex = 0;
}
private void FindDevices()
{
var vidDevices = EncoderDevices.FindDevices(EncoderDeviceType.Video);
var audDevices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
foreach (EncoderDevice dvc in vidDevices)
{
VidDvcsComboBox.Items.Add(dvc.Name);
}
foreach (EncoderDevice dvc in audDevices)
{
AudDvcsComboBox.Items.Add(dvc.Name);
}
}
private void StartButton_Click(object sender, RoutedEventArgs e)
{
try
{
// Display webcam video on control.
webCamCtrl.StartCapture();
}
catch (Microsoft.Expression.Encoder.SystemErrorException ex)
{
MessageBox.Show("Device is in use by another application");
}
}
private void EndButton_Click(object sender, RoutedEventArgs e)
{
// Stop the display of webcam video.
webCamCtrl.StopCapture();
}
private void RecordButton_Click(object sender, RoutedEventArgs e)
{
// Start recording of webcam video to harddisk.
webCamCtrl.StartRecording();
}
private void StopRecord
FearfulSymmetry
22-Oct-12 19:59pm
View
Thank you!