private void SettingsAndSingleShapeSuccessfully() { PplFeatures.SetSpotlightProperties(0.25f, 1f, Color.FromArgb(0x00FF00)); DialogUtil.WaitForDialogBox(PplFeatures.OpenSpotlightDialog, null, "Spotlight Properties"); var spotlightDialog = NativeUtil.FindWindow(null, "Spotlight Properties"); Assert.AreNotEqual(IntPtr.Zero, spotlightDialog, "Failed to find Spotlight Dialog."); // In Win7, it's "25 %", but in Win10, it's "25%" var transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25 %"); if (transparencyDialog == IntPtr.Zero) { transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25%"); } Assert.AreNotEqual(IntPtr.Zero, transparencyDialog, "Failed to find Text Dialog."); // Set text NativeUtil.SendMessage(transparencyDialog, 0x000C /*WM_SETTEXT*/, IntPtr.Zero, "1"); // try to get class's build id var actualContentBuilder = new StringBuilder(1024); NativeUtil.GetClassName(spotlightDialog, actualContentBuilder, 1024); var classBuildId = actualContentBuilder.ToString().Split('.').Last(); var fadeComboBox = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, "WindowsForms10.COMBOBOX.app.0." + classBuildId, null); Assert.AreNotEqual(IntPtr.Zero, fadeComboBox, "Failed to find Fade Dialog."); var sb = new StringBuilder(256, 256); NativeUtil.SendMessage(fadeComboBox, 0x0148 /*CB_GETLBTEXT*/, (IntPtr)2, sb); // Set combo box NativeUtil.SendMessage(fadeComboBox, 0x014E /*CB_SETCURSEL*/, IntPtr.Zero, sb.ToString()); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); DialogUtil.CloseDialogBox(spotlightDialog, "OK"); PpOperations.SelectSlide(4); PpOperations.SelectShape("Spotlight Me"); PplFeatures.Spotlight(); var actualSlide1 = PpOperations.SelectSlide(4); var actualSlide2 = PpOperations.SelectSlide(5); var expSlide1 = PpOperations.SelectSlide(6); var expSlide2 = PpOperations.SelectSlide(7); SlideUtil.IsSameLooking(expSlide1, actualSlide1); SlideUtil.IsSameLooking(expSlide2, actualSlide2); }
// Click Thumbnails Panel to make selectedSlide focused. // When focused, add the agenda beam to the selectedSlide (doesn't have agenda) & sync. // When unfocused, only sync (so selectedSlide (doesn't have agenda) remains the same). private static void ClickOnSlideThumbnailsPanel() { var pptPanel = NativeUtil.FindWindow("PPTFrameClass", null); var mdiPanel = NativeUtil.FindWindowEx(pptPanel, IntPtr.Zero, "MDIClient", null); var mdiPanel2 = NativeUtil.FindWindowEx(mdiPanel, IntPtr.Zero, "mdiClass", null); if (PpOperations.IsOffice2010()) { var thumbnailsPanel = NativeUtil.FindWindowEx(mdiPanel2, IntPtr.Zero, "paneClassDC", "Thumbnails"); NativeUtil.SendMessage(thumbnailsPanel, 0x0201 /*left button down*/, IntPtr.Zero, IntPtr.Zero); } else // Office2013 or Higher { NativeUtil.SendMessage(mdiPanel2, 0x0201 /*left button down*/, IntPtr.Zero, IntPtr.Zero); } }
private void VerifySpotlightSettingsDialogBox() { string spotlightSettingsWindowTitle = "Spotlight Settings"; DialogUtil.WaitForDialogBox(PplFeatures.OpenSpotlightDialog, null, spotlightSettingsWindowTitle); IntPtr spotlightDialog = NativeUtil.FindWindow(null, spotlightSettingsWindowTitle); Assert.AreNotEqual(IntPtr.Zero, spotlightDialog, "Failed to find " + spotlightSettingsWindowTitle + "."); // In Win7, it's "25 %", but in Win10, it's "25%" IntPtr transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25 %"); if (transparencyDialog == IntPtr.Zero) { transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25%"); } Assert.AreNotEqual(IntPtr.Zero, transparencyDialog, "Failed to find Text Dialog."); // Set text NativeUtil.SendMessage(transparencyDialog, 0x000C /*WM_SETTEXT*/, IntPtr.Zero, "1"); // try to get class's build id StringBuilder actualContentBuilder = new StringBuilder(1024); NativeUtil.GetClassName(spotlightDialog, actualContentBuilder, 1024); string classBuildId = actualContentBuilder.ToString().Split('.').Last(); IntPtr fadeComboBox = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, "WindowsForms10.COMBOBOX.app.0." + classBuildId, null); Assert.AreNotEqual(IntPtr.Zero, fadeComboBox, "Failed to find Fade Dialog."); StringBuilder sb = new StringBuilder(256, 256); NativeUtil.SendMessage(fadeComboBox, 0x0148 /*CB_GETLBTEXT*/, (IntPtr)2, sb); // Set combo box NativeUtil.SendMessage(fadeComboBox, 0x014E /*CB_SETCURSEL*/, IntPtr.Zero, sb.ToString()); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); DialogUtil.CloseDialogBox(spotlightDialog, "OK"); }
public void FT_QuickPropertyTest() { PpOperations.SelectSlide(4); Microsoft.Office.Interop.PowerPoint.Shape shape = PpOperations.SelectShape("ffs")[1]; int x = PpOperations.PointsToScreenPixelsX(shape.Left + shape.Width / 2); int y = PpOperations.PointsToScreenPixelsY(shape.Top + shape.Height / 2); WindowWatcher.AddToWhitelist("Format Shape"); MouseUtil.SendMouseDoubleClick(x, y); ThreadUtil.WaitFor(2000); if (PpOperations.IsOffice2010()) { // AKA property handle IntPtr formatObjHandle = NativeUtil.FindWindow("NUIDialog", "Format Shape"); Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle."); NativeUtil.SendMessage(formatObjHandle, 0x10 /*WM_CLOSE*/, IntPtr.Zero, IntPtr.Zero); } else // for Office 2013 or higher { // Spy++ helps to look into the handles IntPtr pptHandle = NativeUtil.FindWindow("PPTFrameClass", null); Assert.AreNotEqual(IntPtr.Zero, pptHandle, "Failed to find PowerPoint handle."); IntPtr dockRightHandle = NativeUtil.FindWindowEx(pptHandle, IntPtr.Zero, "MsoCommandBarDock", "MsoDockRight"); Assert.AreNotEqual(IntPtr.Zero, dockRightHandle, "Failed to find Dock Right handle."); // AKA property handle IntPtr formatObjHandle = NativeUtil.FindWindowEx(dockRightHandle, IntPtr.Zero, "MsoCommandBar", "Format Object"); Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle."); } }