Commit a586d4ab34e8d8ccca28d77cd4cd6a74ffa41049

Authored by Perry Werneck
1 parent 271f6658
Exists in master

Implementando class vb.net

Showing 2 changed files with 95 additions and 1 deletions   Show diff stats
Makefile.in
... ... @@ -26,7 +26,7 @@
26 26  
27 27 GLUELIB=lib3270-mono@DLLEXT@
28 28 LIBNAME=pw3270-sharp.dll
29   -TESTPROGRAM?=vbtest
  29 +TESTPROGRAM?=vbclass
30 30  
31 31 #---[ Configuration values ]-------------------------------------------------------------
32 32  
... ...
testprograms/vbclass.vb 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +'
  2 +' "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 +' (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 +' aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 +'
  6 +' Copyright (C) <2008> <Banco do Brasil S.A.>
  7 +'
  8 +' Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 +' os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 +' Free Software Foundation.
  11 +'
  12 +' Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 +' GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 +' A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 +' obter mais detalhes.
  16 +'
  17 +' Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 +' programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 +' St, Fifth Floor, Boston, MA 02110-1301 USA
  20 +'
  21 +' Este programa está nomeado como vbclass.vb e possui - linhas de código.
  22 +'
  23 +' Contatos:
  24 +'
  25 +' perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 +' erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 +'
  28 +
  29 +Imports System
  30 +Imports System.Text
  31 +Imports System.Runtime.InteropServices
  32 +
  33 +Public Class pw3270
  34 +
  35 + <DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
  36 + Private Shared Function tn3270_create_session(ByVal Name As String) As IntPtr
  37 + End Function
  38 +
  39 + <DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
  40 + Private Shared Function tn3270_destroy_session(ByVal hSession As IntPtr) as Long
  41 + End Function
  42 +
  43 + <DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
  44 + Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long
  45 + End Function
  46 +
  47 + <DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
  48 + Private Shared Function tn3270_get_revision(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long
  49 + End Function
  50 +
  51 + Private Shared hSession As IntPtr
  52 +
  53 + Public Sub New(ByVal name as String)
  54 + hSession = tn3270_create_session(name)
  55 + End Sub
  56 +
  57 + Public Sub Finalize()
  58 + tn3270_destroy_session(hSession)
  59 + End Sub
  60 +
  61 + Public ReadOnly Property Version As String
  62 + Get
  63 + dim buffer As New StringBuilder(1024)
  64 + tn3270_get_version(hSession, buffer, 1024)
  65 + return buffer.toString
  66 + End Get
  67 + End Property
  68 +
  69 + Public ReadOnly Property Revision As String
  70 + Get
  71 + dim buffer As New StringBuilder(1024)
  72 + tn3270_get_revision(hSession, buffer, 1024)
  73 + return buffer.toString
  74 + End Get
  75 + End Property
  76 +
  77 +
  78 +
  79 +End Class
  80 +
  81 +
  82 +Public Module modmain
  83 +
  84 + Sub Main()
  85 +
  86 + dim host as new pw3270("")
  87 +
  88 + Console.WriteLine ("Using pw3270 version " + host.Version + " revision " + host.Revision)
  89 +
  90 +
  91 + End Sub
  92 +
  93 +
  94 +End Module
... ...