FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Lanzar ejecutable desde otro ejecutable.
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Lanzar ejecutable desde otro ejecutable.
Posted: Tue Aug 07, 2012 09:50 PM

Hola a todos,

驴C贸mo har铆an ustedes para lanzar esta aplicaci贸n (y sus par谩metros) desde otra aplicaci贸n?

C:\AMPA1203\Exe\Ampa32.exe /S:10 /P:FF20121030 /F:C:\AMPA1203\EXE\BD\20112012 /A:F

Tanto el ejecutable desde donde pretendo lanzar la otra aplicaci贸n como esta 煤ltima s贸n aplicaciones Fivewin.

Y otra pregunta, 驴Le ven alguna limitaci贸n en cuanto a lanzar la misma aplicaci贸n 'n' veces pero con distintos par谩metros?

Gracias,

Un Saludo

Carlos G.



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

Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: Lanzar ejecutable desde otro ejecutable.
Posted: Tue Aug 07, 2012 10:20 PM
Hola

Yo lo hago de esta manera

Code (fw): Select all Collapse
WinExec( ViewUsu():cPathUpd+"\Update.exe "+cVersion )



programa update.exe
Code (fw): Select all Collapse
function Update( cValor )
聽 聽 local PATHSERVER,聽 聽PATHDATOS, lExe, oIni, Usuario, aFiles, xTmp

聽 聽 if IsExeRunning(cFileName(GetModuleFileName(GetInstance())))
聽 聽 聽 聽 MsgWait( "El programa Update est谩 actualmente corriendo" )
聽 聽 聽 聽 return( .f. )
聽 聽 endif

聽 聽 if empty( cValor )
聽 聽 聽 聽 return( .f. )
聽 聽 endif
聽 聽 聽 //bla-bla-bla
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: Lanzar ejecutable desde otro ejecutable.
Posted: Wed Aug 08, 2012 07:00 AM

Hola,

Aqu铆 tienes tambi茅n otra excelente opci贸n:

http://bielsys.blogspot.com.es/2009/02/ ... ca-de.html

Posts: 505
Joined: Sat Apr 22, 2006 09:09 AM
Re: Lanzar ejecutable desde otro ejecutable.
Posted: Wed Aug 08, 2012 08:11 AM
Hola que tal:

Lo que yo hago para lanzar una aplicaci贸n es crear un archivo .LNK o .BAT:

LNK
Code (fw): Select all Collapse
if file("cyewin.lnk")
聽 erase cyewin.lnk
endif
oShell 聽:= TOleAuto():New( "WScript.Shell" )
o := oShell:CreateShortCut( 'cyewin.lnk')
o:WindowStyle 聽 聽 聽:= 1
o:TargetPath 聽 聽 聽 := CurDrive() + ':\' + CurDir() + '\cyewin\cyewin.exe'
o:Arguments 聽 聽 聽 聽:= ValEjer
o:WorkingDirectory := CurDrive() + ':\' + CurDir() + '\cyewin'
o:Description 聽 聽 聽:= 'CyEWin, Contabilidad y Estimaciones para Windows'
o:IconLocation 聽 聽 := CurDrive() + ':\' + CurDir() + '\cyewin\cyewin.ico'
o:Save()
ShellExecute(0,"Open","cyewin.lnk",NIL,NIL,1)
erase cyewin.lnk


BAT
Code (fw): Select all Collapse
if file("impr.bat")
聽 erase impr.bat
endif
set console off
m := fcreate ("impr.bat",0)
fwrite (m,"cd impranua")
fwrite (m,chr(13))
fwrite (m,chr(10))
fwrite (m,"java -jar PlataformaModulosInformativas.jar /E:" + nombfich + " /V:S /R:" + errofich)
fwrite (m,chr(13))
fwrite (m,chr(10))
fwrite (m,"cd ..")
fwrite (m,chr(13))
fwrite (m,chr(10))
fclose (m)
waitrun("impr.bat",0)
erase impr.bat


Al final uso waitrun o Shellexecute dependiendo de si quiero que espere o no a que termine la ejecuci贸n. Y borro el archivo que he creado.

Un saludo y espero que te sirva.

Carlos
Colt Hop ED, S.L.
Carlos Blas Fern谩ndez Dom铆nguez
Tlfo: 645847093
E-Mail: carlos@colthop.es

Nunca se termina de aprender, por eso necesito siempre ayuda.
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Lanzar ejecutable desde otro ejecutable.
Posted: Wed Aug 08, 2012 11:43 AM
colthop wrote:Hola que tal:

Lo que yo hago para lanzar una aplicaci贸n es crear un archivo .LNK o .BAT:

LNK
Code (fw): Select all Collapse
if file("cyewin.lnk")
聽 erase cyewin.lnk
endif
oShell 聽:= TOleAuto():New( "WScript.Shell" )
o := oShell:CreateShortCut( 'cyewin.lnk')
o:WindowStyle 聽 聽 聽:= 1
o:TargetPath 聽 聽 聽 := CurDrive() + ':\' + CurDir() + '\cyewin\cyewin.exe'
o:Arguments 聽 聽 聽 聽:= ValEjer
o:WorkingDirectory := CurDrive() + ':\' + CurDir() + '\cyewin'
o:Description 聽 聽 聽:= 'CyEWin, Contabilidad y Estimaciones para Windows'
o:IconLocation 聽 聽 := CurDrive() + ':\' + CurDir() + '\cyewin\cyewin.ico'
o:Save()
ShellExecute(0,"Open","cyewin.lnk",NIL,NIL,1)
erase cyewin.lnk


BAT
Code (fw): Select all Collapse
if file("impr.bat")
聽 erase impr.bat
endif
set console off
m := fcreate ("impr.bat",0)
fwrite (m,"cd impranua")
fwrite (m,chr(13))
fwrite (m,chr(10))
fwrite (m,"java -jar PlataformaModulosInformativas.jar /E:" + nombfich + " /V:S /R:" + errofich)
fwrite (m,chr(13))
fwrite (m,chr(10))
fwrite (m,"cd ..")
fwrite (m,chr(13))
fwrite (m,chr(10))
fclose (m)
waitrun("impr.bat",0)
erase impr.bat


Al final uso waitrun o Shellexecute dependiendo de si quiero que espere o no a que termine la ejecuci贸n. Y borro el archivo que he creado.

Un saludo y espero que te sirva.

Carlos


Muchas gracias,

Eso es lo que buscaba.

Un Saludo

Carlos G.



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

Continue the discussion