FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Esperar a que termine la plicaion llamada con ShellExecute
Posts: 162
Joined: Tue Feb 03, 2009 10:08 PM
Esperar a que termine la plicaion llamada con ShellExecute
Posted: Sun Oct 13, 2024 06:38 AM

Amigos buenas Noches... D铆as

Estoy llamando un programa externo para que env铆e un archivo a un WS, usando shellexecute.

mi aplicaci贸n no alcanza a espera a que termine de ejecutarse el programa llamado con el shellexecute

C贸mo implementar a que espere la terminaci贸n de segundo programa?

En el foro he visto shellexecuteEX?, alguien tiene un ejemplo de como usarlo...

O que otra alternativa tengo....

Muchas Gracias.....

J. Ernesto Pinto Q.
Fwh_x64 2501, BCC++_x64 7_70 , Harbour 3.20, LopeEdit 5.8
jepsys@hotmail.com, jepsys@gmail.com

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Sun Oct 13, 2024 07:25 AM

Use WAITRUN() instead.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Sun Oct 13, 2024 01:15 PM

See below all the values ??for the second parameter of the WAITRUN() function:

0 - Hides the window and passes the activation to another window.

1 - Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as 9).

2 - Activates a window and displays it as an icon.

3 - Activates a window and displays it as a maximized window.

4 - Displays a window in its latest size and position. The window that is currently active remains active.

5 - Activates a window and shows it in its current size and location.

6 - Minimizes the specified window and activates the top-level window within the system list.

7 - Displays a window as an icon. The window that is currently active remains active.

8 - Displays a window, in its current state. The window that is currently active remains active.

9 - Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (the same as 1).

Hugs,

xComando := "copy /b temp.txt prn > NUL"

WaitRun( xCOMMAND, 7 )

Regards, Saludos.

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 851
Joined: Sun Nov 09, 2014 05:01 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Mon Oct 14, 2024 01:12 PM
J. Ernesto wrote:Amigos buenas Noches... D铆as

Estoy llamando un programa externo para que env铆e un archivo a un WS, usando shellexecute.
mi aplicaci贸n no alcanza a espera a que termine de ejecutarse el programa llamado con el shellexecute

C贸mo implementar a que espere la terminaci贸n de segundo programa?

En el foro he visto shellexecuteEX?, alguien tiene un ejemplo de como usarlo...

O que otra alternativa tengo....

Muchas Gracias.....
Ernesto, yo lo uso asi y me funciona, prueba...
Code (fw): Select all Collapse
 ShellExecute( 0, "open", "whatsapp://send?phone="+alltrim(aQueryToSms[nCiclo,8])+"&text="+cTexto)
聽do while IsExeRunning("ShellExecute.xsd")
聽enddo
"Los errores en programaci贸n, siempre est谩n entre la silla y el teclado..."



Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin



Carora, Estado Lara, Venezuela.
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Mon Oct 14, 2024 02:45 PM

Interesting. But what is ShellExecute.xsd?

Posts: 851
Joined: Sun Nov 09, 2014 05:01 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Mon Oct 14, 2024 04:05 PM
Enrico Maria Giordano wrote:Interesting. But what is ShellExecute.xsd?

Enrico, good question. I asked myself the same thing when I couldn't find it with the .EXE extension

When I migrated to WINDOWS 11 I encountered that change. Apparently it has to do with something for XML compatibility.

Hopefully one of the masters will shed some light on this. (google traslator)


Enrico, buena pregunta. Me pregunt茅 lo mismo al no encontrarlo con la extensi贸n .EXE

Cuando migr茅 a WINDOWS 11 me encontr茅 con ese cambio. Al parecer tiene que ver con algo para compatibilidad de XML.

Ojal谩 uno de los master nos de una luz al respecto.
"Los errores en programaci贸n, siempre est谩n entre la silla y el teclado..."



Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin



Carora, Estado Lara, Venezuela.
Posts: 162
Joined: Tue Feb 03, 2009 10:08 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute,
Posted: Mon Oct 14, 2024 10:58 PM

Jos茅

Implemente algo similar y funciona perfectamente:

DO WHILE SW60 = " "

IF FILE ( ".\cufe_ok.txt" ); SW60 := "*"

ELSEIF FILE ( ".\cufe_error.txt" ); SW60 := "*"

ELSE ; SYSWAIT ( 0.1 )

ENDIF

ENDDO

Al llamar la segunda aplicaci贸n, esta debe devolver la creaci贸n de un txt.

Gracias.

J. Ernesto Pinto Q.
Fwh_x64 2501, BCC++_x64 7_70 , Harbour 3.20, LopeEdit 5.8
jepsys@hotmail.com, jepsys@gmail.com

Posts: 851
Joined: Sun Nov 09, 2014 05:01 PM
Re: Esperar a que termine la plicaion llamada con ShellExecute
Posted: Mon Oct 14, 2024 11:04 PM

Excelente ernesto!!

A煤n puedes mejorar ese c贸digo si usas iif y or preguntando por la existencia de los archivos y cambiando el suiche todo en una sola linea

"Los errores en programaci贸n, siempre est谩n entre la silla y el teclado..."



Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin



Carora, Estado Lara, Venezuela.

Continue the discussion