G
Gowrisankarrs
Guest
Hello everyone,
I'm trying to automate Rumba mainframe terminal through VB.Net.
I came to know that using EHLAPI32.dll this can be achieved. When I tried the code as an Excel macro, it works fine. But I have to make it work as a VB.Net code. When I converted the code to VB.Net, the code doesn't work. When I run in VB.Net, the return code is 2 whereas in Excel macro it is 0.
Excel Macro code:
Private Declare Function hllapi Lib "C:\Program Files (x86)\Micro Focus\RUMBA\System\ehlapi32.Dll" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Sub Main()
Dim Astr As String
Dim Alen As Integer
Dim RetC As Integer
Dim Func As Integer
Dim ReturnCode As Integer
Func = 1
Astr = "C"
Alen = Len(Astr)
ReturnCode = hllapi(Func, Astr, Alen, RetC)
Func = 3
Astr = "HELLO"
Alen = Len(Astr)
ReturnCode = hllapi(Func, Astr, Alen, RetC)
End Sub
VB.Net code:
Imports System.Runtime.InteropServices
Imports System.Text
Module Module1
Declare Function hllapi Lib "C:\Program Files (x86)\Micro Focus\RUMBA\System\ehlapi32.Dll" (lpwFunction As Int32, lpbyString As String, lpwLength As Int16, lpwReturnCode As Int16) As Int16
Sub Main()
Dim status As Int16
Dim rc As Int16
rc = hllapi(1, "C", 1, status) ' Connect to Presentation Space C
rc = hllapi(3, "HELLO", 5, status) ' Send key 'HELLO'
End Sub
End Module
Any guidance is deeply appreciated. Thanks.
Continue reading...
I'm trying to automate Rumba mainframe terminal through VB.Net.
I came to know that using EHLAPI32.dll this can be achieved. When I tried the code as an Excel macro, it works fine. But I have to make it work as a VB.Net code. When I converted the code to VB.Net, the code doesn't work. When I run in VB.Net, the return code is 2 whereas in Excel macro it is 0.
Excel Macro code:
Private Declare Function hllapi Lib "C:\Program Files (x86)\Micro Focus\RUMBA\System\ehlapi32.Dll" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Sub Main()
Dim Astr As String
Dim Alen As Integer
Dim RetC As Integer
Dim Func As Integer
Dim ReturnCode As Integer
Func = 1
Astr = "C"
Alen = Len(Astr)
ReturnCode = hllapi(Func, Astr, Alen, RetC)
Func = 3
Astr = "HELLO"
Alen = Len(Astr)
ReturnCode = hllapi(Func, Astr, Alen, RetC)
End Sub
VB.Net code:
Imports System.Runtime.InteropServices
Imports System.Text
Module Module1
Declare Function hllapi Lib "C:\Program Files (x86)\Micro Focus\RUMBA\System\ehlapi32.Dll" (lpwFunction As Int32, lpbyString As String, lpwLength As Int16, lpwReturnCode As Int16) As Int16
Sub Main()
Dim status As Int16
Dim rc As Int16
rc = hllapi(1, "C", 1, status) ' Connect to Presentation Space C
rc = hllapi(3, "HELLO", 5, status) ' Send key 'HELLO'
End Sub
End Module
Any guidance is deeply appreciated. Thanks.
Continue reading...