Skip to content

Instantly share code, notes, and snippets.

@simply-coded
Last active July 20, 2024 14:37
Show Gist options
  • 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