iNNOKENTIY21
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: # copy and paste this code to powershell console start notepad.exe function MinimizeWindow { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] $Process ) $ShowWindowAsync = @{ Namespace = 'WinAPI' Name = 'Win32ShowWindowAsync' Language = 'CSharp' MemberDefinition = @' [DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); '@ } if (-not ("WinAPI.Win32ShowWindowAsync" -as [type])) { Add-Type @ShowWindowAsync } $MainWindowHandle = (Get-Process -Name $Process).MainWindowHandle [void] [WinAPI.Win32ShowWindowAsync]::ShowWindowAsync($MainWindowHandle, 2) } MinimizeWindow notepad # enter pressed |
|