static void SendKeyToRevit(byte bVk, int dwFlags)
{
IntPtr Revit = Autodesk.Windows.ComponentManager.ApplicationWindow;
SetForegroundWindow(Revit);
keybd_event(bVk, 0, dwFlags, 0);
}
public static void SendESCToRevit()
{
SendKeyToRevit(0x1B, 0);
SendKeyToRevit(0x1B, 2);
}