ReneMiner
28-09-2013, 19:47
I post this in the name of some other user - David (http://www.thinbasic.com/community/member.php?u=1615) - who's not able to post it himself somehow...
---------------------------------------------------------------------------------------------
Hi thinBasic team,
My Name is David, and i'm pleased to be in your Forum.
I'm NeoBook (http://www.neosoftware.com) and PowerBasic programmer.
NeoBook is a RAD written in Delphi. It has its own dialect programming.
NeoBook has the capability to connect with another languages ( VBScript, Javascript,etc) via Scripts and with other Compiled languages (C, Delphi, PowerBasic) following a SDK.
With this compiled languages, is possible create some kind of Dll's, that works as plugins, growing the capabilities of NeoBook.
When i discovered your BINT32 library, i addapted it in order to use with NeoBook.
This link is a sample how works your library:
http://www.neobook.com.ar/files/DemoBint32.zip
Main Program is written with Neobook, the wrapper of your library is written in PowerBasic.
At this time, program can do:
a) Reset all BINT32 library.
b) Read a Script file (or select it)
c) Set the Script variable values before run the script
d) Run the script
e) Get the Script variable values after run the script
The values of the variables are sent and received using the SDK interface, and can be handled by the NeoBook user into his main program.
Now, i discovered thinBasic, is fantastic !
I'm trying to do a similar program in PowerBasic, to get the potential of your program.
My principal code is: (if you need all program, feel free to ask me...)
////////////////////////////////////////////////////////////////////
#COMPILE DLL "NeoPBThinBasic"
#INCLUDE "Win32Api.inc"
#INCLUDE "ThinCore.inc"
.....
' send variable value to NeoBook enviroment
SUB SetVariable(BYVAL Variable$,BYVAL vuelta$)
CALL DWORD nbSetVar USING SetVarProcType(BYCOPY variable$, BYCOPY vuelta$)
END SUB
.........
Function File_load (File as string) as string
Local tempstr as string
OPEN File FOR BINARY AS #1
x&& = LOF(1)
GET$ #1, x&&, tempstr
CLOSE #1
setvariable "ae_TB_FileData", tempStr
Function = tempstr
End Function
'--------------------------------------------------------------------
' d1 = Text or file.txt (input)
' d2 = kind of input (text or file) (input)
' Buffer & Source are globally defined as string
'--------------------------------------------------------------------
FUNCTION ae_TB_Init () EXPORT AS BYTE
hInst = GetModuleHandle(ByVal %NULL)
hScript = thinBasic_Init(byval 0, hInst,"")
setvariable "ae_TB_hScript", str$(hScript)
setvariable "ae_TB_hInst", str$(hInst)
End Function
'--------------------------------------------------------------------
FUNCTION ae_TB_End () EXPORT AS BYTE
thinBasic_Release(hScript)
End Function
'--------------------------------------------------------------------
FUNCTION ae_TB_Run (d1 AS ASCIIZ, d2 AS ASCIIZ) EXPORT AS BYTE
Buffer = D1
Source = D2
If Source = "F" Then
CALL thinBasic_Run(0, FILE_Load(Buffer), %thinBasic_BufferType_IsFile, 1 Or 2, %FALSE, %FALSE, %FALSE, 1, %FALSE)
Else
CALL thinBasic_Run(0, Buffer, %thinBasic_BufferType_IsScript, 1 Or 2, %FALSE, %FALSE, %FALSE, 1, %FALSE)
End if
END FUNCTION
'--------------------------------------------------------------------
' d1 = PB Var Name (input)
' d2 = PB Var Type; N->Numeric, S->String (input)
' d3 = NeoBook Variable Name (output)
FUNCTION ae_TB_GetVar (d1 AS ASCIIZ, d2 AS ASCIIZ, d3 AS ASCIIZ) EXPORT AS BYTE
Local var1 as string, var2 as string, var3 as string, result as string
Var1 = D1
Var2 = D2
Var3 = D3
if Var1 > "" then
if Var2 = "N" then
Result = str$(thinBasic_VariableGetValueNum(Var1))
replace " " with "" in Result
SetVariable Var3, Result
Else
'SetVariable Var3, BINT_GetString(Var1)
End if
End if
END FUNCTION
'--------------------------------------------------------------------
' d1 = PB Var Name (input)
' d2 = PB Var Value (input)
' d3 = PB Var Type; N->Numeric, S->String (input)
FUNCTION ae_TB_SetVar (d1 AS ASCIIZ,d2 AS ASCIIZ,d3 AS ASCIIZ) EXPORT AS BYTE
Local dd1 as string, dd2 as string, dd3 as string
Local Number AS EXT
dd1 = d1
dd2 = d2
dd3 = d3
If dd3 = "N" Then
number = val(dd2)
CALL thinBasic_ChangeVariableNumber(dd1, number)
Else
CALL thinBasic_ChangeVariableString(dd1, dd2)
End IF
END FUNCTION
/////////////////////////////////////////////////////////////////////////////
At the ae_TB_Init () function i use 2 variables:
- hScript
- hInst
Defined as Global Long
The following line:
hScript = thinBasic_Init(byval 0, hInst,"")
returns hScript value = -1
After this action, nothing works fine.
The principal purpose of my PowerBasic plugin program, is be a bridge between NeoBook and your thinCore.DLL library, for send and receive variable values.
Are there any way to do something like the sample i sent you, but using your thinCore.DLL library ?
Perhaps i need do some special registration, a payment ?
Any ideas ?
Thanks in advance,
Greetings from Buenos Aires, Argentina
David Marcovich
---------------------------------------------------------------------------------------------
Hi thinBasic team,
My Name is David, and i'm pleased to be in your Forum.
I'm NeoBook (http://www.neosoftware.com) and PowerBasic programmer.
NeoBook is a RAD written in Delphi. It has its own dialect programming.
NeoBook has the capability to connect with another languages ( VBScript, Javascript,etc) via Scripts and with other Compiled languages (C, Delphi, PowerBasic) following a SDK.
With this compiled languages, is possible create some kind of Dll's, that works as plugins, growing the capabilities of NeoBook.
When i discovered your BINT32 library, i addapted it in order to use with NeoBook.
This link is a sample how works your library:
http://www.neobook.com.ar/files/DemoBint32.zip
Main Program is written with Neobook, the wrapper of your library is written in PowerBasic.
At this time, program can do:
a) Reset all BINT32 library.
b) Read a Script file (or select it)
c) Set the Script variable values before run the script
d) Run the script
e) Get the Script variable values after run the script
The values of the variables are sent and received using the SDK interface, and can be handled by the NeoBook user into his main program.
Now, i discovered thinBasic, is fantastic !
I'm trying to do a similar program in PowerBasic, to get the potential of your program.
My principal code is: (if you need all program, feel free to ask me...)
////////////////////////////////////////////////////////////////////
#COMPILE DLL "NeoPBThinBasic"
#INCLUDE "Win32Api.inc"
#INCLUDE "ThinCore.inc"
.....
' send variable value to NeoBook enviroment
SUB SetVariable(BYVAL Variable$,BYVAL vuelta$)
CALL DWORD nbSetVar USING SetVarProcType(BYCOPY variable$, BYCOPY vuelta$)
END SUB
.........
Function File_load (File as string) as string
Local tempstr as string
OPEN File FOR BINARY AS #1
x&& = LOF(1)
GET$ #1, x&&, tempstr
CLOSE #1
setvariable "ae_TB_FileData", tempStr
Function = tempstr
End Function
'--------------------------------------------------------------------
' d1 = Text or file.txt (input)
' d2 = kind of input (text or file) (input)
' Buffer & Source are globally defined as string
'--------------------------------------------------------------------
FUNCTION ae_TB_Init () EXPORT AS BYTE
hInst = GetModuleHandle(ByVal %NULL)
hScript = thinBasic_Init(byval 0, hInst,"")
setvariable "ae_TB_hScript", str$(hScript)
setvariable "ae_TB_hInst", str$(hInst)
End Function
'--------------------------------------------------------------------
FUNCTION ae_TB_End () EXPORT AS BYTE
thinBasic_Release(hScript)
End Function
'--------------------------------------------------------------------
FUNCTION ae_TB_Run (d1 AS ASCIIZ, d2 AS ASCIIZ) EXPORT AS BYTE
Buffer = D1
Source = D2
If Source = "F" Then
CALL thinBasic_Run(0, FILE_Load(Buffer), %thinBasic_BufferType_IsFile, 1 Or 2, %FALSE, %FALSE, %FALSE, 1, %FALSE)
Else
CALL thinBasic_Run(0, Buffer, %thinBasic_BufferType_IsScript, 1 Or 2, %FALSE, %FALSE, %FALSE, 1, %FALSE)
End if
END FUNCTION
'--------------------------------------------------------------------
' d1 = PB Var Name (input)
' d2 = PB Var Type; N->Numeric, S->String (input)
' d3 = NeoBook Variable Name (output)
FUNCTION ae_TB_GetVar (d1 AS ASCIIZ, d2 AS ASCIIZ, d3 AS ASCIIZ) EXPORT AS BYTE
Local var1 as string, var2 as string, var3 as string, result as string
Var1 = D1
Var2 = D2
Var3 = D3
if Var1 > "" then
if Var2 = "N" then
Result = str$(thinBasic_VariableGetValueNum(Var1))
replace " " with "" in Result
SetVariable Var3, Result
Else
'SetVariable Var3, BINT_GetString(Var1)
End if
End if
END FUNCTION
'--------------------------------------------------------------------
' d1 = PB Var Name (input)
' d2 = PB Var Value (input)
' d3 = PB Var Type; N->Numeric, S->String (input)
FUNCTION ae_TB_SetVar (d1 AS ASCIIZ,d2 AS ASCIIZ,d3 AS ASCIIZ) EXPORT AS BYTE
Local dd1 as string, dd2 as string, dd3 as string
Local Number AS EXT
dd1 = d1
dd2 = d2
dd3 = d3
If dd3 = "N" Then
number = val(dd2)
CALL thinBasic_ChangeVariableNumber(dd1, number)
Else
CALL thinBasic_ChangeVariableString(dd1, dd2)
End IF
END FUNCTION
/////////////////////////////////////////////////////////////////////////////
At the ae_TB_Init () function i use 2 variables:
- hScript
- hInst
Defined as Global Long
The following line:
hScript = thinBasic_Init(byval 0, hInst,"")
returns hScript value = -1
After this action, nothing works fine.
The principal purpose of my PowerBasic plugin program, is be a bridge between NeoBook and your thinCore.DLL library, for send and receive variable values.
Are there any way to do something like the sample i sent you, but using your thinCore.DLL library ?
Perhaps i need do some special registration, a payment ?
Any ideas ?
Thanks in advance,
Greetings from Buenos Aires, Argentina
David Marcovich