Advertisement
Combreal

minimize-app.ps1

Jan 9th, 2024 (edited)
870
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Win32ShowWindowAsync = Add-Type –memberDefinition @
  2. [DllImport("user32.dll")]
  3. public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
  4. [DllImport("user32.dll")]
  5. public static extern bool ShowWindow(IntPtr handle, int state);
  6. @ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
  7.  
  8. [System.IntPtr] $MainWindowHandle = (Get-Process "*vnc*").MainWindowHandle
  9.  
  10. #minimize
  11. $Win32ShowWindowAsync::ShowWindowAsync($MainWindowHandle, 6)
  12.  
  13. Start-Sleep -Seconds 1
  14.  
  15. #maximize
  16. $Win32ShowWindowAsync::ShowWindow($MainWindowHandle, 1)
Tags: powershell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement