Announcement

Collapse
No announcement yet.

Win HLLAPI C to PB Assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Win HLLAPI C to PB Assistance

    Hello,

    I am attempting to use the Win HLLAPI DLL to copy the presentation
    space from an application into my application.

    The C function is:

    Code:
    void WINAPI WinHLLAPI(LPWORD, LPBYTE, LPWORD, LPWORD);
    I think it is supposed to be called like:

    [quote]
    Code:
    Function Call
    
    WinHLLAPI(COPYPS,lpbyString,lpwLength,lpwReturnnCode)
    
    Call Parameters
    
    Parameter	Description
    Data String	String that will contain the Host session presentation space. The string length must be defined as the maximum size of  the presentation space. If the session option EAB has been set with Set Session Parameters (function 9), the string length must be defined to be at least twice the size of the  presentation space.
    Data Length 	NA (the length of the presentation space is assumed).
    PS Position	NA
    Return Parameters
    
    Parameter	Description
    Data String	String containing the Host session presentation space.
    </font>
    I tried the following in PB, but I always get a SYS ERROR.

    Code:
    FUNCTION CopyPS () AS STRING
    
        LOCAL sPS AS ASCIIZ * 1921 (1920 + 1 null)
        LOCAL lLength   AS INTEGER
        LOCAL lRC       AS INTEGER 
     
        lLength = 0
        lRC = 0
     
        'Send the request to copy the presentation space.
        WinHLLAPI (%COPYPS, BYVAL sPS, lLength, lRC)
        
        PRINT "lLength:" & STR$(lLength) '= 0, but should be 1920.
        PRINT "lRC:" & STR$(lRC) '= 9 for WHLSYSERROR
        
        'Check the return code.
        SELECT CASE lRC
            CASE %WHLLOK
                PRINT "ok"
            CASE %WHLLNOTCONNECTED
                PRINT "notconnected"
            CASE %WHLLPSBUSY
                PRINT "ps busy"
            CASE %WHLLINHIBITED
                PRINT "inhibited"
            CASE %WHLLSYSERROR
                PRINT "sys error"
        END SELECT
    
        'Return the presentation space.
        FUNCTION = sPS
    
    END FUNCTION
    I have gotten many functions working, but have been stuck on this
    one for a week. If anyone can help, I'd really appreciate it!

    -John

    ------------------
    LOCAL MyEMail AS STRING
    MyEMail = "jtintel" & CHR$(64) & "gmail" & CHR$(46) & "com"
    LOCAL MyEMail AS STRING
    MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

  • #2
    I have no knowledge of that DLL or its procedures, but it would appear
    that the sub you're calling automatically determines the length of the
    passed string? If that's the case, then the problem could very well
    be caused by your using an ASCIIZ var for the string. When ASCIIZ's are
    first created they have a NULL in their first character position.
    And the only way I can think of for the called procedure to determine
    the length of the passed string is to check for the location of the
    terminating NULL. And, since you have not assigned any value to
    the ASCIIZ, that terminating NULL will be the very first character, which means the
    procedure thinks the passed string is of zero length. How about trying it with
    a STRING*1921? Or, DIM a dynamic string, and do a string$ = SPACE$(1921)
    and pass the string BYVAL STRPTR().

    ------------------
    clay at clayclear dot net



    [This message has been edited by Clay Clear (edited May 04, 2005).]

    Comment


    • #3
      Thanks Clay! I'm going to try it out this morning.

      John

      ------------------
      LOCAL MyEMail AS STRING
      MyEMail = "jtintel" & CHR$(64) & "gmail" & CHR$(46) & "com"
      LOCAL MyEMail AS STRING
      MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

      Comment


      • #4
        The string I'm looking for is 24 lines by 80 chars = 1920. When
        it was ASCIIZ I figured it should be 1921 (null at end), but I
        forgot about setting it up with spaces at the beginning. I tried
        it the way you suggested, but I couldn't get it to work.

        I'm looking at the C source and I think I might be doing
        something else wrong. There are two different functions that
        I can use... %COPYPS and %COPYPSTOSTR. I have them in C below.
        I don't understand how I can pass a byte though if it is supposed
        to be a string.

        Code:
        in 'h':
        void WINAPI WinHLLAPI(LPWORD, LPBYTE, LPWORD, LPWORD);
        
        (wLength is set to 1920 before both portions of code.)
        
        in 'cpp':
        LPBYTE pBuffer = new BYTE[wLength]; <-- ?
        CallWinHLLAPI(COPYPS, pBuffer); <-- ?
        ShowResults(pBuffer, wLength);
        
        -or-
        
        in 'cpp:
        LPBYTE pBuffer = new BYTE[wLength]; <-- ?
        CallWinHLLAPI(COPYPSTOSTR, pBuffer, 1920, 1); <-- ?
        ShowResults(pBuffer, wLength);
        Thanks!

        ------------------
        LOCAL MyEMail AS STRING
        MyEMail = "jtintel" & CHR$(64) & "gmail" & CHR$(46) & "com"
        LOCAL MyEMail AS STRING
        MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

        Comment


        • #5
          Try this declaration. Original says LPBYTE, which is not specifically a string, but a pointer to any kind of variable...

          Code:
          Declare Sub WinHLLAPI Lib "DLLNAME.DLL" Alias "WinHLLAPI" (ByRef P1 As Word, ByRef P2 As Any, ByRef P3 As Word, ByRef P3 As Word)
          ------------------
          email
          http://www.kgpsoftware.com
          kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

          Comment


          • #6
            Thanks! I made the change. It doesn't work now, but I think
            I'm halfway following this. I need to exchange the string data
            as a pointer back and forth? (I haven't done it this was thus
            far--I'm guessing this is why the others don't work now.)

            My problem now: How do I interact with a pointer? Don't they
            just do one character at a time?

            Thanks!!!!

            John

            ------------------
            LOCAL MyEMail AS STRING
            MyEMail = "jtintel" & CHR$(64) & "gmail" & CHR$(46) & "com"
            LOCAL MyEMail AS STRING
            MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

            Comment


            • #7
              No, a pointer can be used to manipulate data of any length, from just a byte to a huge string block.

              I don't know the specifics of the HLLAPI to help here. A search of HLLAPI turns up 18 matches in POFFs, though.

              ------------------
              email
              http://www.kgpsoftware.com
              kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

              Comment


              • #8
                A pointer is a reference to a specific memory address. It could
                be the starting point of any structure, but the nature of the
                structure much match between the calling process and and the
                called process. If they don't, then errors will occur. A pointer
                is 32-bits in length so that it can denote any address available
                to a 32-bit processor. By using offsets from that pointer
                reference, you can access any part of the structure. If the
                compiler understands the nature of the structure, it can
                determine the appropriate offset values and make the necessary
                boundary checks to ensure you remain in the structure. If you
                are using your own offsets, then the operating system will try
                to validate that your references remain within the allowed
                memory space set aside for your program, but it cannot determine
                whether your combined pointer and offset reference are within
                the scope of the intended structure. When working with DLLs,
                the information on what the structure is, and for strings, their
                size, has to be supported in the calling program, and known
                by the programmer so that he can set up the appropriate
                structure before calling the function in the DLL.

                I hope that makes sence.

                ------------------
                Old Navy Chief, Systems Engineer, Systems Analyst, now semi-retired

                Comment


                • #9
                  I came across this thread while looking for solution to another hllapi problem. I hope you figured this out by now but heres how I do it which works fine without any pointers etc..

                  Code:
                  DECLARE FUNCTION PCOMMAPI CDECL LIB "C:\Program Files\IBM\Personal Communications\ehlapi32.dll" _
                    ALIAS "HLLAPI" (WORD,ASCIIZ,WORD,WORD) AS LONG
                  
                  GLOBAL a             AS ASCIIZ * 2001          ' data (used to read screen buffer)
                  GLOBAL cr            AS STRING * 7             ' callref
                  
                  '------------------------------------------------------------------------------------------------
                  'api ... wrapper function for hllapi (alias pcommapi) that returns the hllapi RC.
                  
                  FUNCTION api (calltype AS WORD,datastring AS ASCIIZ,length AS WORD) AS LONG
                  
                    LOCAL d1 AS LONG             'dummy 
                    LOCAL rcode AS WORD          'return code from hillapi  
                  
                    d1=pcommapi(calltype, datastring, length, rcode)
                  
                    FUNCTION=rcode
                  
                  END FUNCTION
                  '-----------------------------------------------------------------------------------
                  FUNCTION getcallref AS LONG                         ' used in reporting
                  
                  LOCAL rc AS LONG
                  LOCAL errorc AS LONG
                  
                    errorc=0
                    DO
                      rc=api(5,BYREF a,2000)                         ' Read Screen
                      IF rc=0 OR rc=4 OR rc=5 THEN
                        IF MID$(a,242,7)="account" THEN              ' Displaying front screen
                          cr=MID$(a,219,7)
                        ELSEIF MID$(a,212,11)="Call number" THEN     ' Displaying secondary screen
                          cr=MID$(a,224,7)
                        ELSE
                          errorc=2                                   'error2 - not displaying expected screen
                          EXIT LOOP
                        END IF
                      ELSE
                        errorc=1                                     'error1 - emulator error
                        EXIT LOOP
                      END IF
                    LOOP UNTIL %true
                  
                  FUNCTION = errorc
                  
                  END FUNCTION
                  ------------------
                  Andy Upton
                  Scotland
                  http:/courtburn.com andy at courtburn dot com
                  Andy Upton
                  Scotland

                  Comment


                  • #10
                    Shoot me an email, I've got the code MOSTLY converted already.

                    Code:
                    '*******************************************************************************
                    '                Module Header
                    '********************************************************************************
                    
                    'File:       hllapi.h
                    'Purpose:    data structures, definitions & prototypes comprising HLLAPI
                    'Attachmate Technical Support.
                    '*******************************************************************************/
                    
                    '***********************************************************
                    'HLLAPI function selectors ~~ HLLAPI subfunction selectors
                    '***********************************************************
                    
                    %HLL_ATMQUERYSYSTEM              = 0
                    %HLL_CONNECTPS                   = 1
                    %HLL_DISCONNECTPS                = 2
                    %HLL_SENDKEY                     = 3
                    %HLL_WAIT                        = 4
                    
                    %HLL_COPYPS                      = 5
                    %HLL_SEARCHPS                    = 6
                    %HLL_QUERYCURSOR                 = 7
                    %HLL_COPYPSTOSTRING              = 8
                    %HLL_SETHLLWINPARAMETERS         = 9
                    
                    %HLL_QUERYSESSIONS               = 10
                    %HLL_RESERVE                     = 11
                    %HLL_RELEASE                     = 12
                    %HLL_COPYOIA                     = 13
                    %HLL_QUERYFIELDATTRIBUTE         = 14
                    
                    %HLL_COPYSTRINGTOPS              = 15
                    %HLL_WSCTRL                      = 16
                    %HLL_PAUSE                       = 18
                    %HLL_QUERYSYSTEM                 = 20
                    %HLL_RESETHLLWIN                 = 21
                    
                    %HLL_QUERYSESSIONSTATUS          = 22
                    %HLL_STARTHOSTNOTIFICATION       = 23
                    %HLL_QUERYHOSTUPDATE             = 24
                    %HLL_STOPHOSTNOTIFICATION        = 25
                    %HLL_SEARCHFIELD                 = 30
                    
                    %HLL_FINDFIELDPOSITION           = 31
                    %HLL_FINDFIELDLENGTH             = 32
                    %HLL_COPYSTRINGTOFIELD           = 33
                    %HLL_COPYFIELDTOSTRING           = 34
                    %HLL_SETCURSOR                   = 40
                    
                    %HLL_STARTKEYSTROKEINTERCEPT     = 50
                    %HLL_GETKEY                      = 51
                    %HLL_POSTINTERCEPTSTATUS         = 52
                    %HLL_STOPKEYSTROKEINTERCEPT      = 53
                    
                    %HLL_COPYOIA5            = 70
                    %HLL_COPYOIA9            = 71
                    
                    %HLL_SENDFILE                    = 90
                    
                    %HLL_RECEIVEFILE                 = 91
                    %HLL_CONVERT                     = 99
                    
                    '***********
                    'sui generis
                    '************
                    %HLL_HLLAPI                      = 500
                    %HLL_ENUMHLLWINS                 = 501
                    %HLL_QUERYHLLWINPARAMETERS       = 502
                    %HLL_SETMESSAGELOOPCALLBACK      = 503
                    
                    
                    '*************************
                    'system manifest constants
                    '*************************
                    %MAXSENDKEYLENGTH                = 255
                    %MAXPAUSEDURATION                = &HFFFF
                    %MINKEYSTROKEBUFFERLENGTH        = 6
                    %MAXFILETRANSFERSTRINGLENGTH     = 512
                    
                    '*********************************
                    'informal list of HLL return codes
                    '**********************************
                    %HLL_SUCCESS                     = 0
                    %HLL_INVALIDPSID                 = 1
                    %HLL_INVALIDPARAMETER            = 2
                    %HLL_SESSIONOCCUPIED             = 4
                    %HLL_TIMEOUT                     = 4     '  /*  e.g. Wait (XCLOCK/XSYSTEM)*/
                    %HLL_PSLOCKED                    = 5     '  /*  e.g. ConnectPS  */
                    %HLL_PROTECTED                   = 5
                    %HLL_FIELDSIZEMISMATCH           = 6     '  /*  e.g. CopyFieldToString  */
                    %HLL_DATATRUNCATED               = 6     '  /*  e.g. CopyStringToField  */
                    %HLL_INVALIDPSPOSITION           = 7
                    %HLL_NOPRIORSTARTKEYSTROKE       = 8
                    %HLL_NOPRIORSTARTHOSTNOTIFY      = 8
                    %HLL_SYSTEMERROR                 = 9
                    %HLL_RESOURCEUNAVAILABLE         = 11
                    %HLL_SEARCHSTRINGNOTFOUND        = 24     ' /*  e.g. SearchField    */
                    %HLL_UNFORMATTEDHOSTPS           = 24     ' /*  e.g. CopyFieldToString  */
                    %HLL_NOSUCHFIELD                 = 24     ' /*  e.g. FindFieldPosition  */
                    %HLL_NOHOSTSESSIONUPDATE         = 24     ' /*  new code for QueryHostUpdate    */
                    %HLL_KEYSTROKESNOTAVAILABLE      = 25
                    %HLL_HOSTSESSIONUPDATE           = 26     ' /*  end of Pause    */
                    %HLL_KEYSTROKEQUEUEOVERFLOW      = 31
                    
                    %HLL_MEMORYUNAVAILABLE           = 101    ' /*  cf StartKSIntercept   */
                    %HLL_DELAYENDEDBYCLIENT          = 102    ' /*  Wait, Pause, GetKey */
                    %HLL_UNCONFIGUREDPSID            = 103    ' /*  Connect, Intercept    */
                    %HLL_NOEMULATORATTACHED          = 104    ' /*  keystroke intercept, etc */
                    %HLL_WSCTRLFAILURE               = 105
                    
                    '********************************
                    'values for Post Intercept Status
                    '********************************/
                    %HLL_INTERCEPTACCEPTED           = 0
                    %HLL_INTERCEPTREJECTED           = 1
                    
                    '*********************************
                    'wOptionCode values for %HLL_GetKey
                    '**********************************
                    %HLL_GETKEYASCII                 = 0
                    %HLL_GETKEYMNEMONIC              = 1
                    %HLL_GETKEYSHIFTED               = 2
                    
                    '*************************************
                    'options for %HLL_StartHostNotification
                    '**************************************
                    %HLL_NOTIFYALLUPDATES            = 127
                    %HLL_NOTIFYPSUPDATE              = 1
                    %HLL_NOTIFYOIAUPDATE             = 2
                    %HLL_NOTIFYCURSORUPDATE          = 4
                    %HLL_NOTIFYBEEP                  = 8
                    %HLL_NOTIFYBASECOLORCHANGE       = 16
                    %HLL_NOTIFYMODELCHANGE           = 32
                    %HLL_NOTIFYPOWERCHANGE           = 64
                    
                    '*************************************************
                    'field specifiers for %HLL_FindFieldLength/Position
                    '*************************************************
                    %HLL_THISFIELD                   = 0
                    %HLL_NEXTFIELD                   = 1
                    %HLL_PREVIOUSFIELD               = 2
                    %HLL_NEXTPROTECTEDFIELD          = 3
                    %HLL_NEXTUNPROTECTEDFIELD        = 4
                    %HLL_PREVIOUSPROTECTEDFIELD      = 5
                    %HLL_PREVIOUSUNPROTECTEDFIELD    = 6
                    
                    '****************************************
                    'session specifiers for %HLL_QuerySessions
                    '****************************************/
                    %HLL_QUERYSESSIONSCONFIGURED     = 1  ' /*  in config file  */
                    %HLL_QUERYSESSIONSOPENED         = 2  ' /*  opened, i.e. OpenSession () */
                    %HLL_QUERYSESSIONSPOWERED        = 3  ' /*  terminal on */  /*  default */
                    
                    '********************************
                    'option specifiers for %HLL_WSCtrl
                    '********************************
                    %HLL_WSCTRLOPENCONFIGURATION     = 1
                    %HLL_WSCTRLCLOSECONFIGURATION    = 2
                    %HLL_WSCTRLQUERYCONFIGURATION    = 3
                    %HLL_WSCTRLOPENLAYOUT            = 4
                    %HLL_WSCTRLQUERYLAYOUT           = 5
                    %HLL_WSCTRLEMULATORHANDLE        = 6
                    %HLL_WSCTRLSTARTEMULATOR         = 7
                    %HLL_WSCTRLSTOPEMULATOR          = 8
                    %HLL_WSCTRLTERMINALON            = 9
                    %HLL_WSCTRLTERMINALOFF           = 10
                    %HLL_WSCTRLSETEXECUTEPATH        = 11
                    %HLL_WSCTRLQUERYEXTRADIRECTORY   = 12
                    %HLL_WSCTRLALLOWEMULATORUPDATES  = 13
                    %HLL_WSCTRLBLOCKEMULATORUPDATES  = 14
                    %HLL_WSCTRLSTARTMACRO            = 40
                    %HLL_WSCTRLSTARTMACROASYNC       = 41
                    %HLL_WSCRTLFILETRANSFERDIALOG    = 42
                    
                    
                    Type EmulatorControl
                        cPSID As String * 1     ' /*  minimum requirement */
                        byVisibility As Byte    ' /*  N(ormal) I(conic) M(aximized) H(idden)  */
                        byReserved As Byte      ' /*  until 01-Apr-1991, byPower  */
                        byCase As Byte          ' /*  U(pper) M(ixed) */
                        wLeft As Word           ' /*  absolute position, in screen coordinates    */
                        wBottom As Word
                        wRight As Word
                        wTop As Word
                    '   EMULATORCONTROL, FAR * LPEMULATORCONTROL, NEAR * NPEMULATORCONTROL;
                    End Type
                    
                    '*******************************************************************
                    '    19-Jul-1989 this structure is subject to expansion: e.g. fonts, ...
                    '*******************************************************************
                    
                    '/*********************************
                    'option specifiers for %HLL_Convert
                    '*********************************/
                    
                    %HLL_CONVERTPOSITION             = 1
                    %HLL_CONVERTROWCOLUMN            = 2
                    
                    Type HLLParams
                        byAttribute As Byte        '/*  ATTRB or NOATTRB    */
                        byAutoReset As Byte        '/*  AUTORESET or NOAUTORESET    */
                        byConnectType As Byte      '/*  CONLOG or CONPHYS   */
                        byEAB As Byte              '/*  EAB or NOEAB    */
                        cEscape As String * 1         '/*  default '@' */
                        byPause As Byte            '/*  IPAUSE or FPAUSE    */
                        bySearchOrigin As Byte     '/*  SRCHALL or SRCHFROM */
                        bySearchDirection As Byte  '/*  SRCHFORWARD or SRCHBKWD */
                        wTimeOut As Word           '/*  0..64k          */
                        byTrace As Byte            '/*  TRON or TROFF   */
                        byWait As Byte             '/*  TWAIT, LWAIT, NWAIT */
                        byXlate As Byte            '/*  ASCII<->3270DC translation or not   */
                    End Type
                    
                    '/******************************
                    'values for fields of HLLPARAMS
                    '******************************/
                    '/******************
                    'byAttribute values
                    '******************/
                    %HLLWIN_ATTRB            = 1
                    %HLLWIN_NOATTRB          = 2
                    
                    '/******************
                    'byAutoReset values
                    '******************/
                    %HLLWIN_AUTORESET        = 1
                    %HLLWIN_NOAUTORESET      = 2
                    
                    '/***********************
                    'byConnectionType values
                    '***********************/
                    %HLLWIN_CONLOG           = 1
                    %HLLWIN_CONPHYS          = 2
                    
                    '/************
                    'byEAB values
                    '************/
                    %HLLWIN_EAB              = 1
                    %HLLWIN_NOEAB            = 2
                    
                    '/*************
                    'byPause values
                    '*************/
                    %HLLWIN_FPAUSE           = 1
                    %HLLWIN_IPAUSE           = 2
                    
                    '/*********************
                    'bySearchOrigin values
                    '*********************/
                    %HLLWIN_SRCHALL          = 1
                    %HLLWIN_SRCHFROM         = 2
                    
                    '/************************
                    'bySearchDirection values
                    '************************/
                    %HLLWIN_SRCHFRWD         = 1
                    %HLLWIN_SRCHBKWD         = 2
                    
                    '/**************
                    'byTrace values
                    '**************/
                    %HLLWIN_TRON             = 1
                    %HLLWIN_TROFF            = 2
                    
                    '/************
                    'byWait values
                    '************/
                    %HLLWIN_TWAIT            = 1
                    %HLLWIN_LWAIT            = 2
                    %HLLWIN_NWAIT            = 3
                    
                    '/**************
                    'byXlate values
                    '**************/
                    %HLLWIN_XLATE            = 1
                    %HLLWIN_NOXLATE          = 2
                    
                    
                    Type ATMSystem
                        wHLLAPIVersionNumber As Word
                        wHLLAPILevelNumber As Word
                    End Type
                    
                    Type StartIntercept
                        cPSID As String * 1
                        wKeyFilter As Word
                        wQueueLength As Word
                        bWindowsMessage As Integer
                    End Type
                    
                    '/**********************************
                    'values For wKeyFilter interception
                    '**********************************/
                    %HLL_INTERCEPTAIDKEYS    = 1
                    %HLL_INTERCEPTALLKEYS    = 2
                    
                    Type Keystroke
                        cPSID As String * 1
                        szKeystroke As String * %MINKEYSTROKEBUFFERLENGTH
                    End Type
                    
                    
                    Type OIAGroup
                        szOIAGroup As String * 22
                    End Type
                    
                    Type Sessions
                        cPSID As String * 1
                        szLongName As String * 8
                        byState As Byte
                    '            /******************************************
                    '            Bit 0:  configured?         Bit 1:  opened?
                    '            Bit 2:  powered?
                    '            *******************************************/
                        wPSSize As Word
                    End Type
                    
                    Type SessionStatus
                        cPSID As String * 1         '/*  session short Name  */
                        szLongName  As String * 9
                        bType       As Word         '/*  FALSE = CUT;    TRUE = DFT   */
                        byCharacteristics As Byte   'Bit 0: EABs? Y/N        Bit 1: Programmed Symbols Y/N
                        byUsage As Byte
                    '            Bit 0: Configured? Y/N  Bit 1: Opened? Y/N
                    '            Bit 2: Powered? Y/N     Bit 3: AutoPowered? Y/N
                    '            Bit 4: Emulated? Y/N    Bit 5: HLLAPI-Connected? Y/N
                    '            Bit 6: FileTrans? Y/N
                    '            note that Bit 5, HLLAPI-Connected, may be either HLLWin connection,
                    '            HLLWin keystroke interception, Or HLLWin-initiated file transfer
                        wRows As Word
                        wColumns As Word
                    End Type
                    
                    '/****************************************************************
                    'definitions For use In probing the bySessionCharacteristics Byte
                    '****************************************************************/
                    %HLL_SESSIONEABS                 = &H01
                    %HLL_SESSIONPROGRAMMEDSYMBOLS    = &H02
                    
                    '/**********************************************************************
                    'definitions For use In probing the bySessionUsage Byte In SessionStatus
                    '**********************************************************************/
                    %HLL_SESSIONCONFIGURED           = &H01
                    %HLL_SESSIONOPENED               = &H02
                    %HLL_SESSIONPOWERED              = &H04
                    %HLL_SESSIONAUTOPOWERED          = &H08
                    %HLL_SESSIONEMULATED             = &H10
                    %HLL_SESSIONCONNECTED            = &H20
                    
                    '/****************************
                    'HLLWin connections, keystroke
                    'interception, Or monitors
                    '*****************************/
                    
                    %HLL_SESSIONFILETRANSFER         = &H40
                    
                    Type System
                        byHLLAPIMonth As Byte
                        byHLLAPIDay As Byte
                        wHLLAPIYear As Word
                        cPSID As String * 1
                        dwSystemError As Dword
                    '    }       SYSTEM, NEAR * NPSYSTEM, FAR * LPSYSTEM;
                    End Type
                    
                    '/**************************************
                    'exported routines, In alphabetic order
                    '***************************************/
                    
                    'Put CODE BACK In HERE
                    
                    'Routine functions for the HLLAPI function in EHLAPI32.DLL:
                    '--------------------------------------------------------------------------------------------
                    Declare Function HLLAPI Lib "EHLAPI32.DLL" (Func&, ByVal Buffer$, bSize&, RetC&) As Long
                    
                    Global Func As Long              'Which function to call
                    Global bSize As Long             'Sizeof(Buffer)
                    Global RetC As Long              'Return Code
                    Global Buffer As Asciiz * 1921   'size of mod 2 screen plus one character for null
                    Global rc As Long                ' Our local Return Code
                    Global Presskey As Asciiz * 17
                    Global I As String
                    
                    Declare Function QueryATMSystem() As Long
                    Declare Function ConnectPS(Buffer As Asciiz) As Long
                    Declare Function DisconnectPS() As Long
                    Declare Function HllSendKey(Buffer As Asciiz) As Long
                    Declare Function HLLWait() As Long
                    Declare Function CopyPS(Buffer As Asciiz) As Long
                    Declare Function SearchPS() As Long
                    Declare Function QueryCursorLocation() As Long
                    Declare Function CopyPStoString() As Long
                    Declare Function SetSessionParameters() As Long
                    Declare Function QuerySession(Buffer As Asciiz) As Long
                    Declare Function LockKYBD() As Long
                    Declare Function UnLockKYBD() As Long
                    Declare Function CopyOIA() As Long
                    Declare Function QueryFieldAttribute() As Long
                    Declare Function CopyStringToPS() As Long
                    Declare Function HLLPause() As Long
                    Declare Function QuerySystem() As Long
                    Declare Function ResetPS() As Long
                    Declare Function QuerySessionStatus() As Long
                    Declare Function StartHostNotification() As Long
                    Declare Function QueryHostUpdate() As Long
                    Declare Function StopHostNotification() As Long
                    Declare Function HLLSearchField() As Long
                    Declare Function FindFieldPosition() As Long
                    Declare Function FindFieldLength() As Long
                    Declare Function CopyStringToField() As Long
                    Declare Function CopyFieldToString() As Long
                    Declare Function SetCursorPosition() As Long
                    Declare Function StartKeystrokeIntercept() As Long
                    Declare Function HllGetKey() As Long
                    Declare Function PostInterceptStatus() As Long
                    Declare Function StopKeystrokeInterCept() As Long
                    Declare Function HLLSendFile(FileSpec As Asciiz) As Long
                    Declare Function HLLReceiveFile(FileSpec As Asciiz) As Long
                    ------------------
                    Scott Turchin
                    MCSE, MCP+I
                    Computer Creations Software
                    http://www.tngbbs.com/ccs
                    Scott Turchin
                    MCSE, MCP+I
                    http://www.tngbbs.com
                    ----------------------
                    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                    Comment


                    • #11
                      Code:
                      '------------------------------------------------------------------------------------------
                      'HLLAPI.INC - Modified version of HLLAPI.H
                      'There is supposed to be an agreement in place where these codes will work with IBM's EHLLAPI
                      'As well as Attachmate's software.
                      'Code is not verified or tested, you need a mainframe for that.
                      'Modify as you see fit, assume all liability.
                      '==============<>===========================================================
                      '------------------------------------------------------------------------------------------
                      
                      'Routine functions for the HLLAPI function in EHLAPI32.DLL:
                      '--------------------------------------------------------------------------------------------
                      Declare Function HLLAPI Lib "EHLAPI32.DLL" (Func&, ByVal Buffer$, bSize&, RetC&) As Long
                      
                      Global Func As Long              'Which function to call
                      Global bSize As Long             'Sizeof(Buffer)
                      Global RetC As Long              'Return Code
                      Global Buffer As Asciiz * 1921   'size of mod 2 screen plus one character for null
                      Global rc As Long                ' Our local Return Code
                      Global Presskey As Asciiz * 17
                      Global I As String
                      
                      Declare Function QueryATMSystem() As Long
                      Declare Function ConnectPS(Buffer As Asciiz) As Long
                      Declare Function DisconnectPS() As Long
                      Declare Function HllSendKey(Buffer As Asciiz) As Long
                      Declare Function HLLWait() As Long
                      Declare Function CopyPS() As Long
                      Declare Function SearchPS() As Long
                      Declare Function QueryCursorLocation() As Long
                      Declare Function CopyPStoString() As Long
                      Declare Function SetSessionParameters() As Long
                      Declare Function QuerySession(Buffer As Asciiz) As Long
                      Declare Function LockKYBD() As Long
                      Declare Function UnLockKYBD() As Long
                      Declare Function CopyOIA() As Long
                      Declare Function QueryFieldAttribute() As Long
                      Declare Function CopyStringToPS() As Long
                      Declare Function HLLPause() As Long
                      Declare Function QuerySystem() As Long
                      Declare Function ResetPS() As Long
                      Declare Function QuerySessionStatus() As Long
                      Declare Function StartHostNotification() As Long
                      Declare Function QueryHostUpdate() As Long
                      Declare Function StopHostNotification() As Long
                      Declare Function HLLSearchField() As Long
                      Declare Function FindFieldPosition() As Long
                      Declare Function FindFieldLength() As Long
                      Declare Function CopyStringToField() As Long
                      Declare Function CopyFieldToString() As Long
                      Declare Function SetCursorPosition() As Long
                      Declare Function StartKeystrokeIntercept() As Long
                      Declare Function HllGetKey() As Long
                      Declare Function PostInterceptStatus() As Long
                      Declare Function StopKeystrokeInterCept() As Long
                      Declare Function HLLSendFile(FileSpec As Asciiz) As Long
                      Declare Function HLLReceiveFile(FileSpec As Asciiz) As Long
                      '==================================================================================================
                      '==================================================================================================
                      
                      Function PBMain() As Long
                      ' Steps to perform for HLLAPI Transactions (PS = Presentation Space)
                      ' 21 - ResetPS
                      ' 10 - Query PS
                      ' 1  - Connect PS
                      ' 5  - Copy PS
                      ' 2  - Disconnect PS
                      ' 21 - ResetPS
                      
                      End Function
                      '==================================================================================================
                      '==================================================================================================
                      
                      Function QueryATMSystem() As Long
                       'This function examines the Attachmate Software that you are using and returns
                       'its version number and connection type.
                      
                       Func = 0
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0
                                   'Success
                              Case 1
                                   'Invalid string length
                              Case 9
                                   'System Error
                       End Select
                       Function = RetC
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function ConnectPS(Buffer As Asciiz) As Long
                       'ConnectPS  (Connect to Presentation Space)
                       Func = 1
                       bSize = Len(Buffer)
                       RetC = 0
                      
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                          Select Case RetC
                              Case 0    'success
                      '        Case 1    'invalid Session short name
                      '        Case 4    'host Presentation Space was busy/Xclock
                      '        Case 5    'host Presentation Space was locked
                      '        Case 9    'system Error
                      '        Case 11   'host ps In use by another session
                              Case Else
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function DisconnectPS() As Long
                       'DisconnectPS to Session A
                       Func = 2
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                      
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                           Case 0  'Success
                      '     Case 1  'Was not connected
                      '     Case 9  'System Error
                            Case Else
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function HllSendKey(Buffer As Asciiz) As Long
                       'SendKey to Session
                       Func = 3
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0
                              Case Else
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function HLLWait() As Long
                       Func = 4
                       Buffer=""
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, SizeOf(Buffer), RetC)
                       Select Case RetC
                              Case 0  '    Ready For Input
                              Case 1  '    Not connected To PS
                              Case 4  '    Timed Out  X() Or XSYSTEM
                              Case 5  '    Keyboard is locked
                              Case 9  '    System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function CopyPS() As Long
                       'Copy Presentation Space
                       Func = 5
                       Buffer=""
                       RetC = 0
                       bSize = 2048
                       rc = HLLAPI(Func, Buffer, SizeOf(Buffer), RetC)
                       Select Case RetC
                           Case 0    'Good return
                           Case 1    'Not connected to PS
                           Case 2    'Error with string length
                           Case 4    'Copied; Waiting for response
                           Case 5    'Copied; Keyboard locked
                           Case 6    'Data may be truncated
                           Case 9    'System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      Function SearchPS() As Long
                       Func = 6
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Success.  String found
                              Case 1  '      Not connected To PS
                              Case 2  '      Parameter Error
                              Case 7  '      Invalid PS position
                              Case 9  '      System Error
                              Case 24 '      String Not found
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      
                      Function QueryCursorLocation() As Long
                       Func = 7
                       Buffer = ""
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Success.  String found
                              Case 1  '      Not connected To PS
                              Case 2  '      Parameter Error
                              Case 9  '      System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      
                      Function CopyPStoString() As Long
                       Func = 8
                       Buffer = ""
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '     Copy successful
                              Case 1  '     Not connected To PS
                              Case 2  '     Incorrect String length
                              Case 4  '     Copied; waiting For response
                              Case 5  '     Copied; keyboard locked
                              Case 7  '     Invalid PS position
                              Case 9  '     System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function SetSessionParameters() As Long
                       Func = 9
                       Buffer = ""
                       bSize = 0
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Successful
                              Case 2  '    String Length Invalid/Invalid parameter
                              Case 9  '    System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function QuerySession(Buffer As Asciiz) As Long
                       'Copy Presentation Space
                       Func = 10
                       bSize = 0
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case rc
                           Case 0  'Success
                           Case 1  'Not Connected to PS
                           Case 2  'Invalid String Length
                           Case 9  'System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function LockKYBD() As Long
                       Func = 11
                       Buffer = ""
                       bSize = 0
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Successful
                              Case 1  '    Not connected to PS
                              Case 5  '    PS Was inhibited already
                              Case 9  '    System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function UnLockKYBD() As Long
                       Func = 12
                       Buffer = ""
                       bSize = 0
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Successful
                              Case 1  '    Not connected to PS
                              Case 9  '    System Error
                       End Select
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function CopyOIA() As Long
                       Func = 13
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0   '   Target PS is unlocked, OIA copied
                              Case 1   '   Not connected To PS
                              Case 2   '   Invalid String length
                              Case 4   '   OIA copied, PS is busy
                              Case 5   '   OIA copied, PS is locked
                              Case 9   '   System Error
                              Case 10  '   Not supported this release
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function QueryFieldAttribute() As Long
                       Func = 14
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0   '     Successful
                              Case 1   '     Not connected To PS
                              Case 7   '     PS position is invalid
                              Case 9   '     System Error
                              Case 24  '     Byte Not found, unformatted PS
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function CopyStringToPS() As Long
                       Func = 15
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0   '   Successful
                              Case 1   '   Copy Not configured Or Not connected To PS
                              Case 2   '   Parameter Error
                              Case 5   '   Illegal Data; PS locked
                              Case 6   '   Success; Data truncated
                              Case 7   '   Invalid PS position
                              Case 9   '   System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function HLLPause() As Long
                       Func = 18
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Wait duration expired
                              Case 9  '    System Error
                              Case 26 '    PS Or OIA has been updated
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function QuerySystem() As Long
                       'QUERY SYSTEM. Lets you program determine system values
                       'including the level of support provided by the emulator
                       Func = 20
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Successful                   x        x       x        x    x
                              Case 1  '    HLLAPI Not loaded            x        n/s     x        n/s  n/s
                              Case 2  '    Invalid String length        x        n/s     x        x    x
                              Case 9  '    System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function ResetPS() As Long
                       'Call Reset
                       Func = 21
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                      
                       Function=RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function QuerySessionStatus() As Long
                       'Returns information about a session, including short and long names,
                       'type characteristics, and number of rows and columns.
                       Func = 22
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Invalid session
                              Case 2  '      Invalid request
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function StartHostNotification() As Long
                      'This function allows your program to begin to determine if a
                      'Host presentation space or OIA has been updated
                       Func = 23
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '    Successful
                              Case 1  '    Invalid PS
                              Case 2  '    Invalid parameters
                              Case 9  '    System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function QueryHostUpdate() As Long
                       Func = 24
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                      
                       Select Case RetC
                              Case 0  '    No updates have been made    x        x       x        x    x
                              Case 1  '    Invalid PS                   x        x       x        x    x
                              Case 8  '    Call Function 23 first       x        x       x        x    x
                              Case 9  '    System Error                 x        x       x        x    x
                              Case 21 '    OIA wasupdated               x        x       x        x    x
                              Case 22 '    PSwas updated                x        x       x        x    x
                              Case 23 '    Both OIA & PS were updated
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function StopHostNotification() As Long
                      'Disables function 24, which checks for presentation space or OIA updates.
                      'Also stops events from affecting function 18
                       Func = 25
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Invalid PS
                              Case 8  '      No START issued
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function HLLSearchField() As Long
                       Func = 30
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Invalid PS
                              Case 2  '      Parameter Error
                              Case 7  '      Invalid PSposition
                              Case 9  '      System Error
                              Case 24 '      String Not found
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function FindFieldPosition() As Long
                       Func = 31
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected to PS
                              Case 2  '      Parameter Error
                              Case 7  '      Invalid PSposition
                              Case 9  '      System Error
                              Case 24 '      No such field
                              Case 28 '      Field length = 0
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      
                      Function FindFieldLength() As Long
                       Func = 32
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected to PS
                              Case 2  '      Parameter Error
                              Case 7  '      Invalid PSposition
                              Case 9  '      System Error
                              Case 24 '      No such field
                              Case 28 '      Field length = 0
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function CopyStringToField() As Long
                      'Transfers a string of characters into a specified field
                      'in the currently connected presentation space.
                       Func = 33
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 2  '      Parameter Error
                              Case 5  '      PS is locked; bad Data sent
                              Case 6  '      Copied; Data truncated
                              Case 7  '      PS position invalid
                              Case 9  '      System Error
                              Case 24 '      Unformatted PS
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function CopyFieldToString() As Long
                       Func = 34
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 2  '      Parameter Error
                              Case 6  '      String and field lengths are not equal
                              Case 7  '      PS position invalid
                              Case 9  '      System Error
                              Case 24 '      Unformatted PS
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function SetCursorPosition() As Long
                       Func = 40
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 7  '      PS position invalid
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function StartKeystrokeIntercept() As Long
                      'Allows a PC application filter Any keystrokes sent To a session by a terminal operator.
                       Func = 50
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 2  '      Invalid option
                              Case 4  '      PS was busy
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function HllGetKey() As Long
                      'Retrieves a keystroke from a session being intercepted by function 50
                      
                       Func = 51
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 5  '      Inhibited to non-aid keys
                              Case 8  '      InterCept not started
                              Case 9  '      System Error
                              Case 25 '      Keystrokes not available
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function PostInterceptStatus() As Long
                      'Informs the emulator that a keystroke obtained through function 51 is accepted or rejected.
                       Func = 52
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 2  '      Invalid option
                              Case 8  '      InterCept not started
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      '--------------------------------------------------------------------------------------------
                      Function StopKeystrokeInterCept() As Long
                       Func = 53
                       Buffer = ""
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 0  '      Successful
                              Case 1  '      Not connected To PS
                              Case 8  '      InterCept not started
                              Case 9  '      System Error
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      Function HLLSendFile(FileSpec As Asciiz) As Long
                       'SendFile to Session
                       Func = 90
                       Buffer = FileSpec
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 2    '      Parameter Error
                              Case 3    '      File transfer complete
                              Case 4    '      File transfer complete, records segmented
                              Case 9    '      System Error
                              Case 27   '      Terminated by ctrl+c
                              Case 301  '      Invalid Function number
                              Case 302  '      File Not found
                              Case 305  '      Access denied
                              Case 308  '      Insufficient memory
                              Case 310  '      Invalid environment
                              Case 311  '      Invalid format
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      
                      '--------------------------------------------------------------------------------------------
                      
                      Function HLLReceiveFile(FileSpec As Asciiz) As Long
                       'Receive File from Host
                       Func = 91
                       Buffer = FileSpec
                       bSize = SizeOf(Buffer)
                       RetC = 0
                       rc = HLLAPI(Func, Buffer, bSize, RetC)
                       Select Case RetC
                              Case 2    '      Parameter Error
                              Case 3    '      File transfer complete
                              Case 4    '      File transfer complete, records segmented
                              Case 9    '      System Error
                              Case 27   '      Terminated by ctrl+c
                              Case 301  '      Invalid Function number
                              Case 302  '      File Not found
                              Case 305  '      Access denied
                              Case 308  '      Insufficient memory
                              Case 310  '      Invalid environment
                              Case 311  '      Invalid format
                       End Select
                      
                       Function = RetC
                      
                      End Function
                      ------------------
                      Scott Turchin
                      MCSE, MCP+I
                      Computer Creations Software
                      http://www.tngbbs.com/ccs
                      Scott Turchin
                      MCSE, MCP+I
                      http://www.tngbbs.com
                      ----------------------
                      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                      Comment


                      • #12
                        If memory serves, and I have it written down but it's in storage with some books (I can dig it out)
                        YOu have to connect to the PS, do something else, then you can screen scrape etc, and you MUST disconnectPS as well.

                        I do not recall how to use the code exactly now, I had an error as well but it seems to me you have to send it a function number with parameters, which is why i separated out the functions......


                        IBM and Attachmate share the HLLAPI, they partnered up years ago to make it so programmers could write one application using either company's program.

                        EDITED:
                        Oops, they are above, if you do not do these you will also get an error:
                        ' Steps to perform for HLLAPI Transactions (PS = Presentation Space)
                        ' 21 - ResetPS
                        ' 10 - Query PS
                        ' 1 - Connect PS
                        ' 5 - Copy PS
                        ' 2 - Disconnect PS
                        ' 21 - ResetPS

                        Scott

                        ------------------
                        Scott Turchin
                        MCSE, MCP+I
                        Computer Creations Software http://www.tngbbs.com/ccs

                        [This message has been edited by Scott Turchin (edited September 23, 2005).]
                        Scott Turchin
                        MCSE, MCP+I
                        http://www.tngbbs.com
                        ----------------------
                        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                        Comment

                        Working...
                        X