Contenidos
Importante
Localizar un botón de un formulario mediante Microsoft Spy++ https://www.jesusninoc.com/01/31/activar-el-boton-de-start-de-apache-y-de-mysql-en-xampp-control-panel-automaticamente-desde-powershell-utilizando-sendmessage-y-findwindowex-de-user32-dll/#Localizar_el_boton_Start_de_Apache_y_MySQL_con_Microsoft_Spy
Buscar el id de ventana con Microsoft Spy++

Código en PowerShell que permite hacer click utilizando SendMessage y FindWindowEx de user32.dll
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$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); ' # Localizar el proceso de PowerShell_ISE que tiene abierto el formulario $proceso = Get-Process xampp-control $acciones = Add-Type -MemberDefinition $codigo -Name Acciones -PassThru # FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow) # SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam) # Tenemos que localizar la clase mediante Microsoft Spy++ $clase = "TBitBtn" # Tenemos que localizar el botón (COMO HAY MUCHOS BOTONES QUE SE LLAMAN IGUAL HAY QUE BUSCAR EL VALOR IDENT. CON MICROSOFT SPY++) $identidadboton = [uint32]"0x001506A6" # Hacer click en el botón $acciones::SendMessage($identidadboton, 0x00F5, 0, 0) |