C# Minimize all running windows when application runs

Posted by Derek on Stack Overflow See other posts from Stack Overflow or by Derek
Published on 2012-12-04T16:53:02Z Indexed on 2012/12/04 17:04 UTC
Read the original article Hit count: 255

Filed under:
|

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;
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about minimize