|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Remofi
{
public enum ActionType
{
UP,
DOWN
}
public class PPTAction
{
public static void ControlPPT(ActionType at)
{
IntPtr calculatorHandle = FindWindow("PPTFrameClass", null); //find the PPT window
if (calculatorHandle == IntPtr.Zero)
{
MessageBox.Show("PPT is not running.");
}
else
{
SetForegroundWindow(calculatorHandle);
//simulate the 'down' key
SendKeys.SendWait("{" + at.ToString() + "}");
}
}
//Native Windows API to find the PowerPoint window
[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);
[DllImport("USER32.DLL")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.