Exemplo de utilização em vb.net
#15
by
Perry Werneck
example.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Imports System
Imports System.Text
Imports System.Runtime.InteropServices
' This module houses the application's entry point.
Public Module modmain
<DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
Private Shared Function tn3270_create_session(ByVal Name As String) As IntPtr
End Function
<DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
Private Shared Function tn3270_destroy_session(ByVal hSession As IntPtr) as Long
End Function
<DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long
End Function
<DllImport("lib3270-mono", CallingConvention := CallingConvention.Cdecl)> _
Private Shared Function tn3270_get_revision(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long
End Function
' Application's entry point.
Sub Main()
dim host as IntPtr = tn3270_create_session("")
dim buffer As New StringBuilder(1024)
' Get library version
tn3270_get_version(host, buffer, 1024)
dim vrs as String = buffer.toString
' Get Library revision
tn3270_get_revision(host, buffer, 1024)
dim rev as String = buffer.toString
' Write text to the console.
Console.WriteLine ("Using pw3270 version " + vrs + " revision " + rev)
tn3270_destroy_session(host)
End Sub
End Module