1 2 3 4 5 6 7 8 9 10 11 |
$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, "Texto en Notepad") |