Click here to Skip to main content
15,881,839 members
Articles / Programming Languages / C#

Powerpoint Slideshow Controller

Rate me:
Please Sign up or sign in to vote.
2.09/5 (4 votes)
8 Aug 2009CC (ASA 2.5) 56.8K   4.7K   29   6
Powerpoint Slideshow Controller using lasergesture and Motion Detector

Introduction

using your webcam for slideshow presentation, you can slide forward and backward using laser gesture, by moving it from left to right or vice versa.

Codesnipt:

// Code for controlling PowerPoint SlideShow
        private void ControlPowerPoint(string gesture)
        {
            IntPtr powerPointHandle = FindWindow(null, "PowerPoint Slide Show - ["+slideName+"]");
            
            // Verify that PPS is a running process.
            if (powerPointHandle == IntPtr.Zero)
            {
                System.Windows.Forms.MessageBox.Show("Slide Show not running");
                return;
            }
            switch (gesture)
            {
                case "LEFT":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("p");
                    Beeper.RecognizedBeep();
                    break;
                case "RIGHT":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("n");
                    Beeper.RecognizedBeep();
                    break;
                case "DIAGONAL2B":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("n");
                    Beeper.RecognizedBeep();
                    break;
                case "DIAGONAL1A":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("n");
                    Beeper.RecognizedBeep();
                    break;
                case "DIAGONAL1B":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("P");
                    Beeper.RecognizedBeep();
                    break;
                case "DIAGONAL2A":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("P");
                    Beeper.RecognizedBeep();
                    break;
                case "UP":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("n");
                    Beeper.RecognizedBeep();
                    break;
                case "DOWN":
                    SetForegroundWindow(powerPointHandle);
                    SendKeys.SendWait("p");
                    Beeper.RecognizedBeep();
                    break;
            }
        } 

its really fun that you can talk to the windows applications and command them with your application whatever was the method to do that but i like it ..

Video Demo:

http://www.youtube.com/watch?v=eEsMmbY8Lcc

 

Finally:

I would like to thank Ashish Derhgawen for his project Laser Gesture,though thanks for Andrew Kirillov for the Motion Detection Algorithms.  

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Web Developer
Jordan Jordan
Waheed Al-Barghouhi
http://waheedbarghouthi.blogspot.com

Comments and Discussions

 
Questionslideshow with arrow key navigation - looking for sample code Pin
mganesh21-Feb-14 16:23
mganesh21-Feb-14 16:23 
QuestionSlideshow? Pin
kienhv_8715-Jun-10 23:38
kienhv_8715-Jun-10 23:38 
GeneralDynamic XML template-based PowerPointCreator in C# Pin
Elmue29-Aug-08 13:06
Elmue29-Aug-08 13:06 
GeneralThis is the same as Ashish Derhgawen article Pin
Sacha Barber10-Jun-07 0:50
Sacha Barber10-Jun-07 0:50 
GeneralRe: This is the same as Ashish Derhgawen article [modified] Pin
Waheed AL Barghouthi10-Jun-07 4:08
Waheed AL Barghouthi10-Jun-07 4:08 
GeneralRe: This is the same as Ashish Derhgawen article Pin
Sacha Barber11-Jun-07 0:26
Sacha Barber11-Jun-07 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.