by TecniSoftware » Tue May 15, 2007 1:21 am
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!