Created
January 18, 2015 09:03
-
-
Save hinchley/f4bd00110ff1d155be0b to your computer and use it in GitHub Desktop.
Disable Microsoft Office 2013 Border Shadow with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -TypeDefinition @" | |
using System; | |
using System.Runtime.InteropServices; | |
namespace Utilities { | |
public static class Display { | |
private const uint WM_USER = 0x0400; | |
private const uint WM_MSO = WM_USER + 0x0900; | |
private const uint WM_MSO_WPARAM_OMFRAMEENABLESHADOW = 0x0075; | |
private const uint WM_MSO_LPARAM_SHADOW_DISABLED = 0x0000; | |
private const uint WM_MSO_LPARAM_SHADOW_ENABLED = 0x0001; | |
[DllImport("user32.dll", CharSet = CharSet.Auto)] | |
private static extern IntPtr SendMessage( | |
IntPtr hWnd, | |
UInt32 Msg, | |
IntPtr wParam, | |
IntPtr lParam | |
); | |
public static void DisableShadows(IntPtr hwndOfficeApp) { | |
SendMessage( | |
hwndOfficeApp, | |
(UInt32) WM_MSO, | |
(IntPtr) WM_MSO_WPARAM_OMFRAMEENABLESHADOW , | |
(IntPtr) WM_MSO_LPARAM_SHADOW_DISABLED | |
); | |
} | |
public static void EnableShadows(IntPtr hwndOfficeApp) { | |
SendMessage( | |
hwndOfficeApp, | |
(UInt32) WM_MSO, | |
(IntPtr) WM_MSO_WPARAM_OMFRAMEENABLESHADOW , | |
(IntPtr) WM_MSO_LPARAM_SHADOW_ENABLED | |
); | |
} | |
} | |
} | |
"@ | |
$hwnd = @(Get-Process winword)[0].MainWindowHandle | |
[Utilities.Display]::DisableShadows($hwnd) |
Is there anyway to make it permanent?
Thanks
Still work with Office 2019 and O365, Just tried as I wrote this question. Seems the article above is already taken down and M$ have no intention to make it as an option for a default option. So Sad.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't: https://support.microsoft.com/en-us/help/2821007/how-to-disable-shadow-hwnds-in-office-2013-applications
"There is no user setting to disable these shadows."