FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ShellexecuteEx() paràmetros
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
ShellexecuteEx() paràmetros
Posted: Tue Nov 05, 2024 07:09 PM

Hola a todos,

Tengo entendido que ShellExecuteEx() permite dar nombre a la ventana ( CMD ) que se ejecute, así como esperar a que el proceso que se ha lanzado acabe y de un resultado.

Tenemos la sintáxis de ShellExecuteEx() en Harbour? Existe en Harbour()

Muchas gracias,

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: ShellexecuteEx() paràmetros
Posted: Wed Nov 06, 2024 12:18 AM
Esto responde Claude.AI :shock:
Code (fw): Select all Collapse
#include "hbwin.ch"
#include "windows.ch"

FUNCTION EjecutarArchivo(cArchivo, cOperacion, cParametros, nShow)
   LOCAL oShell
   LOCAL lSuccess := .F.
   
   // Valores por defecto
   DEFAULT cOperacion  := "open"
   DEFAULT cParametros := ""
   DEFAULT nShow       := SW_SHOWNORMAL
   
   // Crear objeto Shell
   oShell := win_ShellExecuteEx()
   
   // Configurar parámetros
   oShell:lpFile       := cArchivo
   oShell:lpOperation  := cOperacion
   oShell:lpParameters := cParametros
   oShell:nShow        := nShow
   
   // Ejecutar
   lSuccess := oShell:Execute()
   
   IF !lSuccess
      ? "Error al ejecutar:", oShell:GetLastError()
   ENDIF
   
   RETURN lSuccess

// Ejemplos de uso:
PROCEDURE Main()
   // Abrir un documento PDF
   EjecutarArchivo("documento.pdf")
   
   // Abrir una URL en el navegador predeterminado
   EjecutarArchivo("https://harbour.github.io", "open")
   
   // Ejecutar un programa con parámetros
   EjecutarArchivo("notepad.exe", "open", "archivo.txt", SW_MAXIMIZE)
   
   // Imprimir un documento
   EjecutarArchivo("documento.doc", "print")
RETURN
Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: ShellexecuteEx() paràmetros
Posted: Wed Nov 06, 2024 05:05 PM

Al final optaré por ShellExecute()

Lo poco que he leído, con ShellExecute() tendré suficiente y en las pruebas que he hecho me vale.

Muchas gracias César.

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: ShellexecuteEx() paràmetros
Posted: Wed Nov 06, 2024 06:00 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion