Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: cliv en Junio 14, 2012, 06:14:57 am
-
I found a freeware library for generate 2d Barcode DataMatrix Encode SDK here:
http://intbusoft.com/solutions/barcode/DataMatrixEncodeSDK/ (http://intbusoft.com/solutions/barcode/DataMatrixEncodeSDK/)
Example of use is in C. I Try to convert to Vb6 but 'RuntimeError 6 - overflow appear
Can someone help?? Please
Public Declare Function EncodeDataMatrix Lib "DataMatrixEncode.dll" _
(ByVal EncodeText As String, ByVal EncodeSize As Integer, _
ByVal out_bitmap As String, ByVal buffer_size As Integer, _
ByVal SizeCell As Long, ByVal Code As Long, _
ByVal Mode As Long, ByVal SizeNum As Long) _
As Integer
s = 1000000
buf = "Test"
out_bitmap = Space(s)
lenbuf = Len(buf)
en = EncodeDataMatrix(buf, lenbuf, out_bitmap, s, 4, 0, 5, 0)
'Write out_bitmap to a BMP file. How??
Function declare is corect?.
In C++ is declare:
int EncodeDataMatrix(
char* EncodeText,
int EncodeSize,
unsigned char* out_bitmap,
int *bufer_size,
int SizeCell,
int Code,
int Mode,
int SizeNum
);out_bitmap is declare as unsigned char* i declare as string . This is corect.
-
Try to change Integer to long in your EncodeDataMatrix declaration
-
Try to change Integer to long in your EncodeDataMatrix declaration
I try....but crash...
Here is a as ample
http://www.4shared.com/zip/7Mv_VfNf/DataMatrix.html (http://www.4shared.com/zip/7Mv_VfNf/DataMatrix.html)
-
C++ Int = VB6 Long, everytime you should use Long instead of Int :P
Public Declare Function EncodeDataMatrix Lib "DataMatrixEncode.dll" _
(ByVal EncodeText As String, ByVal EncodeSize As Long, _
ByVal out_bitmap As String, ByVal buffer_size As Long, _
ByVal SizeCell As Long, ByVal Code As Long, _
ByVal Mode As Long, ByVal SizeNum As Long) _
As Long
-
C++ Int = VB6 Long, everytime you should use Long instead of Int :P
Thank you for this....but still crash....maybe is wrong when i transpose sample code from C to VB
-
Public Declare Function EncodeDataMatrix Lib "DataMatrixEncode.dll" _
(ByVal EncodeText As String, ByVal EncodeSize As Long, _
ByRef out_bitmap As String, ByVal buffer_size As Long, _
ByVal SizeCell As Long, ByVal Code As Long, _
ByVal Mode As Long, ByVal SizeNum As Long) _
As Long
-
Public Declare Function EncodeDataMatrix Lib "DataMatrixEncode.dll" _
(ByVal EncodeText As String, ByVal EncodeSize As Long, _
ByRef out_bitmap As String, ByVal buffer_size As Long, _
ByVal SizeCell As Long, ByVal Code As Long, _
ByVal Mode As Long, ByVal SizeNum As Long) _
As Long
Thank you..
...but when i run this:
Private Sub cmdCommand1_Click()
Dim s As Long
Dim buf As String
Dim out_bitmap
s = 10000000
buf = "TEST"
out_bitmap = Space(s)
result = EncodeDataMatrix(buf, Len(buf), out_bitmap, s, 4, 0, 5, 0)
If result = 0 Then
'Write out_bitmap
Else
MsgBox "Error"
End If
End Sub
...error Type mismatch...