Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: LeandroA en Enero 20, 2014, 04:51:55 pm
-
Hola, alguien tiene algun codigo para generar codigos de barra, si no me equivoco el que presiso se se llama code39, el lugar donde lo tengo que ejecutar no tengo privilegios, por lo que no puedo instalar nada, ni emplear internet. Si mal no recuerdo se puefe hacer empleando algunos metodos graficos. Gracias
Enviado desde mi MB525 usando Tapatalk 2
-
La dll itextsharp te puede resolver eso, no la he utilizado en vb6 pero puede manejar todos los tipos de codigos de barras, tambien crearlos en documentos pdf o imagen.
-
Una dll no me seria de utilidad por lo privilegios, en el ultimo de los casos un exe con lineas de comandos, pero preferiria codigo de fuente para estudiarlo y adaptarlo a nesesidad.
Enviado desde mi MB525 usando Tapatalk 2
-
Yo empleo un código, pero debería ver si es el code39. En un rato podré verificarlo y si es ese te lo paso.
Saludos.
Jerónimo
-
Estimado Leandro
Quizás te sea de utilidad, el siguiente enlace:
BARCODE39 Tutorial with BARCODE Engine
http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=65192&lngWId=1 (http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=65192&lngWId=1)
Saludos
-
bajate la fuente de cod39 y sin necesidad de instalar nada
-
Chequea este enlace
http://es.fontriver.com/font/code_39/ (http://es.fontriver.com/font/code_39/)
en un módulo:
Option Explicit
Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function AddFontResource Lib "GDI32" Alias "AddFontResourceA" (ByVal FontFileName As String) As Long
Private Declare Function RemoveFontResource Lib "GDI32" Alias "RemoveFontResourceA" (ByVal FontFileName As String) As Long
Private Declare Function CreateScalableFontResource Lib "GDI32" Alias "CreateScalableFontResourceA" _
(ByVal fHidden As Long, ByVal lpszResourceFile As String, _
ByVal lpszFontFile As String, ByVal lpszCurrentPath As String) As Long
Private Function GetTempPathName() As String
Dim sBuffer As String, lRet As Long
sBuffer = String$(255, vbNullChar)
lRet = GetTempPath(255, sBuffer)
If lRet > 0 Then
sBuffer = Left$(sBuffer, lRet)
End If
GetTempPathName = sBuffer
End Function
Private Function CheckFile(FileName As String) As Boolean 'check if a file exists
On Error GoTo ErrH
CheckFile = False
If Dir(FileName) <> "" Then
If (GetAttr(FileName) And vbDirectory) = 0 Then
CheckFile = True
Kill FileName
Else
Exit Function
End If
Else
Exit Function
End If
ErrH:
End Function
Public Function GetFontName(FileNameTTF As String) As String
Dim hFile As Integer, Buffer As String, FontName As String, TempName As String, iPos As Integer
TempName = GetTempPathName & "tempfntinfo.tmp"
CheckFile (TempName)
If CreateScalableFontResource(0, TempName, FileNameTTF, vbNullString) Then
hFile = FreeFile
Open TempName For Binary Access Read As hFile
Buffer = Space(LOF(hFile))
Get hFile, , Buffer
iPos = InStr(Buffer, "FONTRES:") + 8
FontName = Mid(Buffer, iPos, InStr(iPos, Buffer, vbNullChar) - iPos)
Close hFile
Kill TempName
End If
GetFontName = FontName
End Function
Public Function UseFont(FontFileName As String)
AddFontResource (FontFileName)
UseFont = GetFontName(FontFileName)
End Function
Public Function RemoveFont(FontFileName As String)
RemoveFontResource (FontFileName)
End Function
en el formulario:
Dim fntFileName01 As String
Dim fntName01 As String
Private Sub Form_Load()
fntFileName01 = App.Path & "\nombredefuente.ttf"
fntName01 = UseFont(fntFileName01)
Label1.Caption = "Canalvisualbasic"
Label1.FontName = fntName01
Label1.FontSize = 16
End Sub
Private Sub Form_Unload(Cancel As Integer)
RemoveFont (fntFileName01)
End Sub
Fuente: http://www.canalvisualbasic.net/foro/texto-y-fuentes-de-caracteres/agregar-fonts-fuentes-externas-5399/ (http://www.canalvisualbasic.net/foro/texto-y-fuentes-de-caracteres/agregar-fonts-fuentes-externas-5399/)
-
Gracias a todos, ya voy armando algo, lo tengo que pasar para vba.