Skip to content

Instantly share code, notes, and snippets.

@simply-coded
Last active January 16, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simply-coded/4838cc069349037d811ddab515804501 to your computer and use it in GitHub Desktop.
Save simply-coded/4838cc069349037d811ddab515804501 to your computer and use it in GitHub Desktop.
An always on top notepad for taking notes and such.
# makes a notepad process that remains on top of other windows.
$cs = Add-Type -MemberDefinition '
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr a, IntPtr b, int c, int d, int e, int f, uint g);
public static void AlwaysOnTop(IntPtr a, int d) { SetWindowPos(a, (IntPtr)(-1), 0, d-250, 300, 200, 64); }
' -Name PS -PassThru;
$hWnd = Start-Process -FilePath notepad -PassThru;
$screen = Get-WmiObject -Class Win32_VideoController | Select-Object CurrentVerticalResolution;
$cs::AlwaysOnTop($hWnd.MainWindowHandle, $screen.CurrentVerticalResolution);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment