Scripting ...
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
In xharbour ,
we can do :
we can do :
Code: Select all
__HrbRun( <file.hrb> )
// or
cHrb := memoread( "file.hrb" )
pBody := __hrbload( cHrb ) // __hrbload( "file.hrb" ) also works
// pBody is pointer variable
__hrbdo ( pBody )
// or we can make a small function
FUNCTION XHRBRUN ( cSource ) // can be file on disk or buffer in memory
RETURN __HrbDo( __HrbLoad( cSource ) )
// note: this is from the sourc of ver 99.70
// works with ver 99.71
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Yes thanks. I forgot to unload the pointer.
The above function can be used for .hrb file on disk or hrb compiled code in memory ( ideal for storing in database and execute retrieved code )
Code: Select all
FUNCTION xHrbRun( cHRBfileNameOrcHRBCode )
LOCAL pHrb
__HrbRun( pHrb := __HrbLoad( cHRBfileNameOrcHRBCode ) )
__HrbUnload( pHrb )
RETURN NIL
// Note: arguments support still to be added
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Antonio Linares wrote:My mistake, you can directly execute it from memory too
__HrbRun( MemoRead( "another.hrb" ) )
Thanks for the samples and explanations , Antonio . I'll tried that . Only one question - can we use FWH syntax in this externals prgs ? That's the "another.prg" can contain DIALOG , BUTTONS , GET in FWH syntax ? Also it's one important - will that suport native class ? I'm using xHarbour Bcc ...
With best regards ! Rimantas
Rimantas U.
nageswaragunupudi wrote:Yes thanks. I forgot to unload the pointer.
The above function can be used for .hrb file on disk or hrb compiled code in memory ( ideal for storing in database and execute retrieved code )Code: Select all
FUNCTION xHrbRun( cHRBfileNameOrcHRBCode ) LOCAL pHrb __HrbRun( pHrb := __HrbLoad( cHRBfileNameOrcHRBCode ) ) __HrbUnload( pHrb ) RETURN NIL // Note: arguments support still to be added
Always get error :
Code: Select all
Application
===========
Path and name: C:\A\AMDI\eng32.exe (32 bits)
Size: 2,767,360 bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 2007.11.02, 18:43:23
Error description: Error BASE/9999 Corruption detected: __HRBLOAD
Args:
Stack Calls
===========
Called from: => __HRBRUN(0)
Called from: ENG32.PRG => XHRBRUN(2190)
Called from: ENG32.PRG => TAPPLIC:SCRPT(1819)
Called from: ENG32.PRG => (b)TAPPLIC:BUILDBAR(691)
Called from: btnbmp.prg => TBTNBMP:CLICK(0)
Called from: btnbmp.prg => TBTNBMP:LBUTTONUP(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: control.prg => TBTNBMP:HANDLEEVENT(0)
Called from: window.prg => _FWH(0)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(0)
Called from: ENG32.PRG => TAPPLIC:ACTIVATE(344)
Called from: ENG32.PRG => MAIN(109)
Regards ! Rimantas
Rimantas U.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Thanks Antonio ! Your test is working - simply __HbRun() . Also I tried with __HbRun( MemoRead( cFile ) ) - it return the same error "Corupption detected __HbLoad" . It seems that works only HbRun ...Antonio Linares wrote:Rimantas,
Please try the test I posted
Many thanks Antonio , it seems that you directed me to true way ...
With best regards ! Rimantas
Rimantas U.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact: