Calling DLL Subroutine
I'd like to know how to create VB Scripting code to call a subroutine within an existing custom DLL file our company created. I assume I use multi-line scripting. I will pass the values of text objects defined on the template into the subroutine. The function will return a string that will need to be displayed in a separate human readable text object and the same string will be used to generate a Code 128 linear barcode. The human readable text object is separate from the barcode object because I don't know how to rotate the text 90 degrees vertical using the barcode object.
-
Peter Thane
★ BarTender Hero ★
Not tried linking BT to a DLL before but googled and found this which may point you in the right direction.
https://www.codeproject.com/Articles/79314/How-to-Call-a-NET-DLL-from-a-VBScript-2
Multi-line script may be a workable option but, depending on your label, you you need to configure it as an Event Controlled Script to make sure it processes at the correct time in the printing procedure. For example, if you are using a database connection then you may need to configure the VB to run OnNewRecord so that you are sure it will use the live data from the database record selected and process your routine using that.
For the barcode/human readable you will need to turn the human readable to None and then add a text field onto the label for this item and add it as an Object Value field and connect to the barcode > Human Readable Text.
The image below shows this. I have set this up as an EAN13 in the example to show that this will include calculated check digits too as the data source/value of the barocde only has the first 12 characters
0 -
Curtis Felt
★ BarTender Hero ★
Peter, Thank you for your reply. I haven't worked with VB for a couple decades now, so I'm an old somewhat experienced programmer! I understood the help on the barcode human readable text rotation. My main challenge is the DLL. Thank you for the resource; it is a start. Maybe further explanation can provide a way for more guidance.
I have an existing DLL file. I have original VB code that declares variables and types and declares a public subroutine that lists the variables passed to it:
Public Declare Sub DoSomething Lib "MyDLL.dll" Alias "enc3" (ByVal year As Integer, ByVal month As Integer, ByVal day As Integer, ByVal batch As Integer, ByVal exp As Integer, ByVal BCType As Integer, ByVal BarcodeString As String, ByVal status As String)
As long as I assign BarTender object values to these variables, I can call the subroutine to generate a string and then link the string to the barcode object for it to display the barcode. I assume it's that simple, but I may need help creating the VB script.
0
Please sign in to leave a comment.
Comments
2 comments