Hola a todos,
Alguien ha utilizado xbscript para correr PRGs externos desde una aplicación?
Saludos,
Jairo Centeno
Ayuda con XBSCript
-
- Posts: 13
- Joined: Thu Mar 08, 2007 6:04 pm
- Location: Zaragoza, España
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 13
- Joined: Thu Mar 08, 2007 6:04 pm
- Location: Zaragoza, España
- TecniSoftware
- Posts: 213
- Joined: Fri Oct 28, 2005 6:29 pm
- Location: Quilmes, Buenos Aires, Argentina
Las funciones para correr archivos HRB
/*
__HRBRUN( <cFile> [, xParam1 [, xParamN ] ] ) -> xReturn
Execute specified hrb file, passing optional paramaters.
__HRBLOAD( <cFile> ) -> nHandle
Load an hrb file and return a Handle.
__HRBDO( <nHandle> )
Execute previously loaded hrb module specified by it's Handle.
__HRBUNLOAD( <nHandle> )
Unload an hrb module.
__HRBGETFU( <nHandle>, <cFuncName> ) -> nHandle
Retrieve Handle to specified function in a given preloaded hrb module.
__HRBDOFU( <nHandle>, [xParam1 [, xParamN] ] ) -> xReturn
Execute specified function by its handle, passing optional paramaters.
*/
Function Test( cMsg, cTitle )
Local cIn := "c:\temp\Test.prg"
Local cOut := cCurDrive() + ":\" + CurDir() + "\Test.hrb"
Local cCompiler := "c:\Harbour\bin\Harbour.exe"
Local cCommand
Local pHrb
Local u
FErase( cOut )
cCommand := cCompiler + " " + cIn + " /gh /n"
nResult := WaitRun( cCommand, 0 )
If nResult == 0
pHrb := __hrbLoad( cOut )
u := __hrbDo( pHrb, cMsg, cTitle ) // Llamo a la function que esta
__hrbUnload( pHrb ) // test.prg y le paso los param.
Else
MsgStop( "Error al compilar el archivo " + cIn, "Error!" )
EndIf
Return u
// test.prg
function main( ctext, ctitle )
return msginfo( ctext, ctitle )
Espero que te sirva.
Saludos!
/*
__HRBRUN( <cFile> [, xParam1 [, xParamN ] ] ) -> xReturn
Execute specified hrb file, passing optional paramaters.
__HRBLOAD( <cFile> ) -> nHandle
Load an hrb file and return a Handle.
__HRBDO( <nHandle> )
Execute previously loaded hrb module specified by it's Handle.
__HRBUNLOAD( <nHandle> )
Unload an hrb module.
__HRBGETFU( <nHandle>, <cFuncName> ) -> nHandle
Retrieve Handle to specified function in a given preloaded hrb module.
__HRBDOFU( <nHandle>, [xParam1 [, xParamN] ] ) -> xReturn
Execute specified function by its handle, passing optional paramaters.
*/
Function Test( cMsg, cTitle )
Local cIn := "c:\temp\Test.prg"
Local cOut := cCurDrive() + ":\" + CurDir() + "\Test.hrb"
Local cCompiler := "c:\Harbour\bin\Harbour.exe"
Local cCommand
Local pHrb
Local u
FErase( cOut )
cCommand := cCompiler + " " + cIn + " /gh /n"
nResult := WaitRun( cCommand, 0 )
If nResult == 0
pHrb := __hrbLoad( cOut )
u := __hrbDo( pHrb, cMsg, cTitle ) // Llamo a la function que esta
__hrbUnload( pHrb ) // test.prg y le paso los param.
Else
MsgStop( "Error al compilar el archivo " + cIn, "Error!" )
EndIf
Return u
// test.prg
function main( ctext, ctitle )
return msginfo( ctext, ctitle )
Espero que te sirva.
Saludos!