1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
$code = @" using System; using System.Runtime.InteropServices; public class API { [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); } "@ $t = Add-Type -TypeDefinition $code -PassThru $t::SendMessage(0xffff, 0x0112, 0xf170, 2) (New-Object -ComObject Shell.Application).MinimizeAll() $codigo=' [DllImport("user32.dll", EntryPoint = "FindWindowEx")]public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll")]public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam); ' $notepad=Start-Process notepad -PassThru $notepad.WaitForInputIdle() $acciones=Add-Type -MemberDefinition $codigo -Name TextoNotepad -PassThru #FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow) #SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam) $acciones::SendMessage([IntPtr]$acciones::FindWindowEx($notepad.MainWindowHandle, [IntPtr]::Zero, "Edit", $null), 0x000C, 0, "TE ESTOY ESPIANDO") |