C# Minimize all running windows when application runs
- by Derek
I am working on a C# windows form application. How can i edit my code in a way that when more than 2 faces is being detected by my webcam.
More information:
When "FaceDetectedLabel.Text = "Faces Detected : " + cam.facesdetected.ToString();" becomes Face Detected: 2 or more...
How can i do the following:
Minimize all program running except my application.
Log out of my computer
Here is my code:
namespace PBD
{
public partial class MainPage : Form
{
//declaring global variables
private Capture capture; //takes images from camera as image frames
public MainPage()
{
InitializeComponent();
}
private void ProcessFrame(object sender, EventArgs arg)
{
Wrapper cam = new Wrapper();
//show the image in the EmguCV ImageBox
WebcamPictureBox.Image = cam.start_cam(capture).Resize(390, 243, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC).ToBitmap();
FaceDetectedLabel.Text = "Faces Detected : " + cam.facesdetected.ToString();
}
private void MainPage_Load(object sender, EventArgs e)
{
#region if capture is not created, create it now
if (capture == null)
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
Application.Idle += ProcessFrame;
}