Baanboard.com

Go Back   Baanboard.com > Blogs > gfasbender's blog

User login

Frontpage Sponsor

Main

Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
19%
200 - 500 GB
28%
500 - 800 GB
2%
800 - 1200 GB
7%
1200 - 1500 GB
7%
1500 - 2000 GB
12%
> 2000 GB
24%
Total votes: 83

Baanboard at LinkedIn


Reference Content

 
VB Calling DLL
By gfasbender at 18 Apr 2008 - 16:44

There has been a few posts concerning the process of calling a Baan DLL function from VB code within a Windows application.

The attached zip file contains an example Excel spreadsheet and DLL that extracts Baan Text.

Baan DLL Function: (Library tudllolegwc): vb_dll_example.zip

 

VB Code

Sub GetBaanText()
Dim BaanCompany As Long
Dim TextNumber As Long
Dim Line As Long
Dim StrText As String

BaanCompany = Val(Cells(2, 1)) ' cell (row 2, col 1) is Company
TextNumber = Val(Cells(2, 2)) ' cell (row 2, col 2) is Text Number
Line = 1
Cells(2, 3) = ""

Call GetTextLines(BaanCompany, TextNumber, Line, StrText)
Cells(2, 3) = StrText ' cell (row 2, col 3) is returned Baan Text

End Sub


Sub GetTextLines(compnr As Long, TxtNum As Long, ByRef Line As Long, ByRef Text)
Dim LineCnt As String
Dim rText As String
Dim strTxtNum As String
Dim strCompany As String
Dim strLine As String

strCompany = Format(compnr, "000")
strTxtNum = Format(TxtNum, "000000000")
strLine = Format(Line, "0000")
cText = ""

' Loop until all lines of text are returned (4K bytes returned with each call)
While Line > 0
rText = String(4000, " ")
dllname = "otudllolegwc"
dllfunction = "tudll.olegwc.get.text.blks" & "("
dllfunction = dllfunction & Chr(34) & strCompany & Chr(34) & ", "
dllfunction = dllfunction & Chr(34) & strTxtNum & Chr(34) & ", "
dllfunction = dllfunction & Chr(34) & strLine & Chr(34) & ", "
dllfunction = dllfunction & Chr(34) & rText & Chr(34) & ")"
Call SendtoBAAN(dllname, dllfunction)

' Baan4
strlen = Len(BaanObj.FunctionCall)
tstr = BaanObj.FunctionCall

' Baan5
'strlen = Len(BaanObj.ReturnCall)
'tstr = BaanObj.ReturnCall

Line = Val(Mid(tstr, 47, 10))
tstr = RTrim(Mid(tstr, 53, strlen - 4))
cText = cText & RTrim(Mid(tstr, 1, Len(tstr) - 2))
Wend

Text = cText
End
AttachmentSize
vb_dll_example.zip17.91 KB
0
No votes yet


All times are GMT +2. The time now is 23:45.


©2001-2018 - Baanboard.com - Baanforums.com