RIDELIGHTNING
IS-IT--Management
Hey all,
I really need some help. I've been searching the web for three days straight and I can't find anything to help me along.
What I'm trying to do: I'm using VBA from Access to enter keystrokes in Netmanages Rumba for Mainframes. I'm somewhat successful in doing this with sendkey but I'm having to put in timers to wait for screen transitions. This kind of works but you never really know when Rumba is ready to receive again. So I did the research and found that WHLLAPI can tell me when Rumba is ready.
The problem: I wrote (for the first time) code to call the API functions from WHLLAPI.dll. I'm getting back totally unexpected results so I'm guessing I'm doing something very wrong. Below is API main call and one of it's functions, my code, and result.
extern VOID FAR PASCAL WinHLLAPI( )
LPWORD lpwFunction, /* Function name */
LPBYTE lpbyString, /* String pointer */
LPWORD lpwLength, /* String (data) length */
LPWORD lpwReturnCode ); /* Return code */
here's the function i'm calling
Prerequisite Functions
None.
Function Call
WinHLLAPI(CONNECTPS,lpbyString,lpwLength,lpwReturnnCode)
Call Parameters
Parameter Description
Data String One-character short name session ID of the Host session to connect with, either an upper- or lower-case letter.
Data Length NA (defaults to 1).
PS Position NA
Return Codes
Code Description
WHLLOK Connect request successful and the specified session is unlocked and ready for input.
WHLLNOTCONNECTED Connect request failed, specified short name session ID is invalid.
WHLLPSBUSY Connect request successful, but the specified session is busy.
WHLLINHIBITED Connect request successful, but the specified session is locked (input inhibited).
WHLLSYSERROR Connect request failed due to a system error.
WHLLUNAVAILABLE Connect request failed, specified session is unavailable (already in use).
my code
Now if I have Rumba running or not I get:
In the first msgbox retc = -4093
In the second I get 61443
I confused! Now the documentation has words for the return codes but defines the variable as an integer. How am I supposed to interpret that? When I was at the IBM site looking at EHLLAPI they have integers as return codes but they're like 1 through 10 (maybe up to 100). I must be calling the function wrong.
Any help from you smart people out there would be MOST appreciated!!!
I really need some help. I've been searching the web for three days straight and I can't find anything to help me along.
What I'm trying to do: I'm using VBA from Access to enter keystrokes in Netmanages Rumba for Mainframes. I'm somewhat successful in doing this with sendkey but I'm having to put in timers to wait for screen transitions. This kind of works but you never really know when Rumba is ready to receive again. So I did the research and found that WHLLAPI can tell me when Rumba is ready.
The problem: I wrote (for the first time) code to call the API functions from WHLLAPI.dll. I'm getting back totally unexpected results so I'm guessing I'm doing something very wrong. Below is API main call and one of it's functions, my code, and result.
extern VOID FAR PASCAL WinHLLAPI( )
LPWORD lpwFunction, /* Function name */
LPBYTE lpbyString, /* String pointer */
LPWORD lpwLength, /* String (data) length */
LPWORD lpwReturnCode ); /* Return code */
here's the function i'm calling
Prerequisite Functions
None.
Function Call
WinHLLAPI(CONNECTPS,lpbyString,lpwLength,lpwReturnnCode)
Call Parameters
Parameter Description
Data String One-character short name session ID of the Host session to connect with, either an upper- or lower-case letter.
Data Length NA (defaults to 1).
PS Position NA
Return Codes
Code Description
WHLLOK Connect request successful and the specified session is unlocked and ready for input.
WHLLNOTCONNECTED Connect request failed, specified short name session ID is invalid.
WHLLPSBUSY Connect request successful, but the specified session is busy.
WHLLINHIBITED Connect request successful, but the specified session is locked (input inhibited).
WHLLSYSERROR Connect request failed due to a system error.
WHLLUNAVAILABLE Connect request failed, specified session is unavailable (already in use).
my code
Code:
Option Compare Database
Private Declare Function WinHLLAPI Lib "C:\Program Files\NetManage\System\WHLLAPI.dll" _
(ByRef Func As Integer, ByVal DataString As String, ByRef Length As Integer, ByRef RetC As Integer) As Long
Sub mytest()
Dim str As String
Dim lng As Integer
lng = 0
str = "X"
HLL 2, str, 1, lng
End Sub
Private Function HLL(Func As Integer, Astr As String, Alen As Integer, RetC As Integer)
Dim str As String
Dim returncode As Long
returncode = WinHLLAPI(Func, Astr, Alen, RetC)
MsgBox ("astr = " & Astr & " alen = " & Alen & " retc = " & RetC)
MsgBox (returncode)
End Function
In the first msgbox retc = -4093
In the second I get 61443
I confused! Now the documentation has words for the return codes but defines the variable as an integer. How am I supposed to interpret that? When I was at the IBM site looking at EHLLAPI they have integers as return codes but they're like 1 through 10 (maybe up to 100). I must be calling the function wrong.
Any help from you smart people out there would be MOST appreciated!!!