|
-
writing/calling a .DLL in VB (visual studio 2010)
Visual Studio 2010 (VB)
I want to call the function do_barcode() in the dll AxBarcodeCG.dll
i have added a reference to axbarcode to the project containing the caller code, but when i run it i get the error "Unable to find an entry point named 'do_barcode' in DLL 'axbarcodecg'."
can anyone see what i am doing wrong?
PS i am new to VS 2010 and DLL writing.
PPS there is probably a more elegant way to build a printer escape sequence that the one i have used,. 
thanks in advance.
// *************************************************** //
AxBarcodeCG.dll
Public Class AxBarcodeCG
Public Const DLL_PROCESS_DETACH = 0
Public Const DLL_PROCESS_ATTACH = 1
Public Const DLL_THREAD_ATTACH = 2
Public Const DLL_THREAD_DETACH = 3
Public Function DllMain(ByVal hInst As Long, ByVal fdwReason As Long,
ByVal lpvReserved As Long) As Boolean
Select Case fdwReason
Case DLL_PROCESS_DETACH
' No per-process cleanup needed
Case DLL_PROCESS_ATTACH
DllMain = True
Case DLL_THREAD_ATTACH
' No per-thread initialization needed
Case DLL_THREAD_DETACH
' No per-thread cleanup needed
End Select
End Function
Public Function do_barcode(ByVal var As String) As String
Dim myString As String
myString = Chr(27) + Chr(16) + Chr(65) + Chr(8) + Chr(4) + Chr(0) + Chr(0) + Chr(3) + Chr(1) + Chr(1) + Chr(1) + Chr(1)
myString = myString + Chr(27) + Chr(16) + Chr(66) + Chr(14) + Chr(65) + "1111-1234567" + Chr(103)
Return myString
End Function
End Class
// ************************************************************************* //
// Caller Code
Public Class Form1
Private Declare Function do_barcode Lib "axbarcodecg" (ByVal escapestr As String) As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TextBox1.Text = do_barcode(1)
End Sub
End Class
Similar Threads
-
Replies: 4
Last Post: 12-26-2007, 09:59 AM
-
By Maria Jose Serres in forum dotnet.announcements
Replies: 0
Last Post: 02-19-2003, 02:54 PM
-
By Patrick Troughton in forum .NET
Replies: 1
Last Post: 02-12-2003, 09:31 AM
-
By joe smith in forum .NET
Replies: 2
Last Post: 08-30-2002, 02:03 PM
-
By Robert Scoble in forum ASP.NET
Replies: 0
Last Post: 07-20-2000, 04:11 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks