neuraljack
21st January 2004, 13:11
Hi all,
how to create a DLL in BaaN.
Thanx in advance
sudhamani
21st January 2004, 13:17
Hi,
In baan IV, go to tools --> application development --> Program scripts/libraries --> maintenance --> maintain libraries (ttadv2131m000)
here create a library and write the code in the library, compile it and then it has to be linked to the program script in the following way:
in the session ttadv2130m000, on th first form click on the button libraries. here enter the library you want to use in this program script. when you want to call a particular function in the DLL, just call the function from the program script and while run time it will go and check in the DLL for that function.
hope this is clear.
neuraljack
21st January 2004, 13:29
hi sudhamani ,
It is very clear! Thank for ur swift reply
neuraljack
21st January 2004, 13:36
hi,
Could u give sample DLL Program.
thanx in advance
nneilitz
21st January 2004, 16:50
Here is a standard dll I use. DLLs save a lot of headache versus having to recode or includes where you have to recompile. The "function extern" syntax is really the only difference between
this and a standard script (Note that this dll must be compiled using -d ottdllbw in compile flag
|***************************************************|***************************
|* tscsiexport 0 VRC B40C c2 csi0
|* Standard Export
|* bsp
|* 10-06-03 [14:20]
|******************************************************************************
|* Script Type: Library
|******************************************************************************
#pragma nowarnings
#include <bic_tt> |include tools functions
#include "itcmcscsi0001" |Standard Report Variables
function extern domain tcnama date.string(domain tcdate input.date)
{
domain tcnama hold.datestring
hold.datestring = date.to.inputstr$(input.date, "%D002,3", 8)
hold.datestring = hold.datestring(3;2) & "/" & hold.datestring(1;2) & "/" & hold.datestring(5;4)
return(hold.datestring)
}
function extern domain tcdesc replace.quotes(domain tcdesc temp.instring)
{
long i,j,z
z = len(temp.instring)
for i = 1 to z
if temp.instring(i;1) = """" then
|message(temp.instring)
for j = z to i + 1 step - 1
temp.instring(j + 2;1) = temp.instring( j;1)
endfor
temp.instring(i;2) = """"""
|message(temp.instring)
i = i + 2
z = z + 2
endif
endfor
|message(temp.instring)
return(temp.instring)
}
function extern domain tcdesc remove.quotes(domain tcdesc temp.instring)
{
long i,j,z
z = len(temp.instring)
for i = 1 to z
if temp.instring(i;1) = """" then
|message(temp.instring)
for j = i to z - 1
temp.instring(j;1) = temp.instring( j + 1;1)
endfor
i = i + 2
z = z + 2
endif
endfor
|message(temp.instring)
return(temp.instring)
}
function extern output.header(domain tcmcs.s999 outstring )
{
long templong
long newfile
newfile = seq.open( serverfilename, "a" )
templong = seq.puts( outstring, newfile)
seq.close(newfile)
}
function extern output.line(domain tcmcs.s999 outstring )
{
long templong
long newfile
newfile = seq.open( serverfilename, "a" )
templong = seq.puts( outstring, newfile)
seq.close(newfile)
}
function extern set.filenames()
{
form.asofdate = date.to.inputstr$(date.num(), "%D002,3", 8)
form.asofdate = form.asofdate(3;2) & form.asofdate(1;2) & form.asofdate(5;4) &str$(time.num())
serverfilename = "/baan/userdata/"&hold.loginuser&hold.exportname&form.asofdate&".csv"
localfilename = "c:\temp\"&hold.exportname&form.asofdate&".csv"
}
function extern start.excel()
{
string tmp.file(1024) | Temporary file name.
string local.path(1024) | Location on client for report.
long rc | Return code.
string appl(132) | Application to start.
long app_id | Application id.
string start(1024) | Parameter for the app_start
| function which has application
| and file to use.
long err
| Copy file to the client.
err = server2client(serverfilename, localfilename, 1)
if (err) then
message("Error copying file to "&localfilename&" make sure that you have a c:\temp directory", err)
endif
| Start the file.
appl = "C:\program files\microsoft office\office\excel.exe"
start= appl&" "&localfilename
| Start the apllication
app_id = app_start(start,"","","","")
| Start the file.
appl = "C:\program files\microsoft office\office10\excel.exe"
start= appl&" "&localfilename
| Start the apllication
app_id = app_start(start,"","","","")
| Start the file.
appl = "E:\program files\microsoft office\office10\excel.exe"
start= appl&" "&localfilename
| Start the apllication
app_id = app_start(start,"","","","")
|Check status of Application.
rc = app_status(app_id)
if(rc = 0) then
message("Application start failed.")
endif
| Remove our work file
seq.unlink(tmp.file)
}
function extern domain tcmcs.s999 replace.char(domain tcmcs.s999 instring, string findchar, string replacechar )
{
long i
domain tcmcs.s999 tempstring
for i = 1 to len(instring)
if instring(i;1) = findchar then
if len(replacechar) = 1 then
instring(i;1) = replacechar
endif
| Replace with a space
if len(replacechar) = 0 then
tempstring = instring(i + 1;len(instring) - i )
instring(i;len(tempstring)) = tempstring
endif
endif
endfor
return(instring)
}
function extern print.help()
{
| This session will run the standard program conversion session
| ttstpconv using a temporary output file and the arguments
| passed in 3+ verbatim.
string tmp.file(1024) | Temporary file name.
string local.path(1024) | Location on client for report.
long rc | Return code.
string appl(132) | Application to start.
long app_id | Application id.
string start(1024) | Parameter for the app_start
| function which has application
| and file to use.
long err
localfilename="t:\Public~1\Inform~1\BaaNUs~1\"&strip$(shiftl$(hold.csicustom)&".doc")
| Start the file.
appl = "C:\program files\microsoft office\office\winword.exe"
start= appl&" "&localfilename
|message(start)
| Start the apllication
app_id = app_start(start,"","","","")
| Start the file.
appl = "C:\program files\microsoft office\office10\winword.exe"
start= appl&" "&localfilename
| Start the apllication
app_id = app_start(start,"","","","")
| Start the file.
appl = "E:\program files\microsoft office\office10\winword.exe"
start= appl&" "&localfilename
| Start the apllication
app_id = app_start(start,"","","","")
|Check status of Application.
rc = app_status(app_id)
if(rc = 0) then
message("Application start failed.")
endif
}
ahulikavi
22nd January 2004, 06:52
Hi,
Can you use a win32 DLL in BaaN or vice versa. If so any examples ?
regards