How to make HLLAPI Code work in VB.Net RRS feed

  • Question

  • 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.

    Friday, October 9, 2020 2:14 PM

All replies

  • Hi Gowrisankarrs,

    Thank you for posting here.

    According to your question, I note that EHLAPI32.dll is a third-party interface

    Unfortunately, we only provide the support for Microsoft related products.

    In order to get more efficient responses, you can consider posting your question on related forums.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 12, 2020 1:53 AM