Skip to main content

How Do I Capture Cursor Location using WinHLLAPI?

  • June 14, 2017
  • 5 replies
  • 1 view

Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba

5 replies

Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba
Hi GeorgeT,

First of all Rumba 8.0 is no longer supported in July 2012 (see: supportline.microfocus.com/prodavail.aspx. So we can't provide an support for that version.

Having said that I've tested you code (having removed the @4 from your Function 3 call) and it successfully reports the Cursor Location and also finds the location of the "HELLO" string.

I suspect that your problem is that you are sending the PF4 key and and are not waiting for a host response before querying the cursor location. You should wait until the X-Clock has cleared before attempting to read the cursor location.

You can test this by manually entering the PF4 and then modifying the Function 3 call above removing the @4 before executing your code.

Tom

Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba

Hello Tom,

I've removed the F4 ("@4") from my code and run it. It types "Hello" but when it runs Function 7, I get a Return Code of 9 System Error. After the code runs, I can see my cursor position in on Line 4 the entire time (Both before and after SendKeys). So my result should be greater than 240 (screen size is set to 80)...I have even added a Wait (Function 4); but that returns code 10, rather than the successful 0 like I expect. I've added further notes in the yellow sections below.

Thank you for reviewing this and testing for me. Is it possible my version of WinHLLAPI is out of date? Thank you.

 

Sub TestABC()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC

Func = 9 '(SetSessionParameters --to make sure I'm waiting upto a minute for X-Clock...Even setting this parameter there is no delay on my computer)
Astr = "TWAIT"
Alen = Len(Astr)
WinHLLAPI Func, Astr, Alen, RetC

Func = 3 '(SendKey)
Astr = "HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC

Func = 4 '(WAIT)
Astr = 0
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC 'This returns 10 which isn't a valid error code as far as I can tell; not sure if it actually waited...
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC 'This still returns 9 System Error. Cannot figure out why my computer shows 9
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC 
'Arow = Int(Alen / 80) 1
'Acol = Alen Mod 80
'MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 


Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba

Hi George,

I see you are using a VT session so the Host <--> Terminal traffic is asynchronous. i.e. there is no x-clock. This makes things a little more complicated and not all HLLAPI functions will work as they were designed for handling synchronous host conversations (IBM Mainframe & AS400).

I've tested your macro against RUMBA 9.5 and the Function 7 does work, but it does not update to the new cursor position after I do a Function 3, unless I add in a wait.

Using the HLLAPI wait mechanism doesn't work. We are talking to an asynchronous host so there is no x-Clock or OIA (unlike 3270 or 5250 sessions).

I constructed my own "wait" code highlighted below. I first wait for up to a second for the cursor to start moving (20*50msec), then I wait for up to another second for the cursor to stop moving for a minimum of 250msec.

Hope that helps,
Tom

Here is my code:

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetCurrentTime Lib "kernel32" Alias "GetTickCount" () As Long

Sub TestABC()
ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "W"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC

Func = 9 '(SetSessionParameters --to make sure I'm waiting upto a minute for X-Clock...Even setting this parameter there is no delay on my computer)
Astr = "TWAIT"
Alen = Len(Astr)
WinHLLAPI Func, Astr, Alen, RetC

Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC

Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
OrgLocation = Alen
MsgBox "Row = " & Arow & ", Col = " & Acol

Func = 3 '(SendKey)
Astr = "Hello"
Alen = Len(Astr)
WinHLLAPI Func, Astr, Alen, RetC


StartTime = GetCurrentTime

For i = 1 To 20
   Sleep 50
   Func = 7 '(QueryCursorLocation)
   Astr = ""
   Alen = 0
   WinHLLAPI Func, Astr, Alen, RetC
   If OrgLocation <> Alen Then Exit For
Next i

OrgLocation = -1

For j = 1 To 4
   If OrgLocation = Alen Then
       Exit For
   Else
       OrgLocation = Alen
   End If
   Sleep 250

   Func = 7 '(QueryCursorLocation)
   Astr = ""
   Alen = 0
   WinHLLAPI Func, Astr, Alen, RetC
Next j

MsgBox "i = " & i & ", j = " & j & ": Execution Time = " & (GetCurrentTime - StartTime) & "msec"

Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol

Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen
WinHLLAPICleanup

End Sub


Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba

Hi George,

I see you are using a VT session so the Host <--> Terminal traffic is asynchronous. i.e. there is no x-clock. This makes things a little more complicated and not all HLLAPI functions will work as they were designed for handling synchronous host conversations (IBM Mainframe & AS400).

I've tested your macro against RUMBA 9.5 and the Function 7 does work, but it does not update to the new cursor position after I do a Function 3, unless I add in a wait.

Using the HLLAPI wait mechanism doesn't work. We are talking to an asynchronous host so there is no x-Clock or OIA (unlike 3270 or 5250 sessions).

I constructed my own "wait" code highlighted below. I first wait for up to a second for the cursor to start moving (20*50msec), then I wait for up to another second for the cursor to stop moving for a minimum of 250msec.

Hope that helps,
Tom

Here is my code:

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetCurrentTime Lib "kernel32" Alias "GetTickCount" () As Long

Sub TestABC()
ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "W"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC

Func = 9 '(SetSessionParameters --to make sure I'm waiting upto a minute for X-Clock...Even setting this parameter there is no delay on my computer)
Astr = "TWAIT"
Alen = Len(Astr)
WinHLLAPI Func, Astr, Alen, RetC

Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC

Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
OrgLocation = Alen
MsgBox "Row = " & Arow & ", Col = " & Acol

Func = 3 '(SendKey)
Astr = "Hello"
Alen = Len(Astr)
WinHLLAPI Func, Astr, Alen, RetC


StartTime = GetCurrentTime

For i = 1 To 20
   Sleep 50
   Func = 7 '(QueryCursorLocation)
   Astr = ""
   Alen = 0
   WinHLLAPI Func, Astr, Alen, RetC
   If OrgLocation <> Alen Then Exit For
Next i

OrgLocation = -1

For j = 1 To 4
   If OrgLocation = Alen Then
       Exit For
   Else
       OrgLocation = Alen
   End If
   Sleep 250

   Func = 7 '(QueryCursorLocation)
   Astr = ""
   Alen = 0
   WinHLLAPI Func, Astr, Alen, RetC
Next j

MsgBox "i = " & i & ", j = " & j & ": Execution Time = " & (GetCurrentTime - StartTime) & "msec"

Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol

Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen
WinHLLAPICleanup

End Sub


Hello,

I'm creating a spreadsheet to script keystrokes into SMART and would like to use the "QueryCursorLocation" to help determine when Rumba is ready to receive input. However, I'm constantly returning a #9 System Error when I try to use Function 7 (QueryCursorLocation). My other Functions are working fine. Can you tell what I'm doing wrong? Below is a sample of the Macro I'm using to test the results of each function.

(I'm modifying a sample macro I found in other forum posts, but it has been very useful to me)

Micro Focus Rumba - Version 8.0.0 SP0 Patch0

 

 

 

'START EXCEL VBA MACRO; COPY/PASTE this in a new Excel VBA Module and make sure your WHLLAPI.DLL file paths are accurate

Private Declare Function WinHLLAPIStartup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (ByVal Version%, ByVal Buffer$) As Long
Private Declare Function WinHLLAPI Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Private Declare Function WinHLLAPICleanup Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\system\\WHLLAPI.DLL" () As Long

Sub Test()

ShortNameIndex = 257
ShortNameList = Space(100)
WinHLLAPIStartup ShortNameIndex, ShortNameList

Func = 1 '(ConnectPresentationSpace)
Astr = "A"
Alen = 1
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 3 '(SendKey)
Astr = "@4HELLO"
Alen = 7
WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC


Func = 7 '(QueryCursorLocation)
Astr = ""
Alen = 0
WinHLLAPI Func, Astr, Alen, RetC
MsgBox "Func " & Func & ": Alen = " & Alen & ", RetC = " & RetC
Arow = Int(Alen / 80) 1
Acol = Alen Mod 80
MsgBox "Row = " & Arow & ", Col = " & Acol


Func = 6 '(SearchPresentationSpace)
Astr = "HELLO"
Alen = Len(Astr)
RetC = 1

WinHLLAPI Func, Astr, Alen, RetC
'MsgBox "Func " & Func & ": RetC = " & RetC & ": Location = " & Alen

 

WinHLLAPICleanup
End Sub

 

Thank you for your help.


#Rumba
Hello Tom, Thank you for your response and working on this with me. I'm interested in your additional reference "GetTickCount"...That's not one I've seen before. I appreciate your showing it to me.

However, I'm still running into Error Code 9 when I call Function 7 using the above code. The execution time returns ~1500ms every time. It enters the "j" For...Next loop and always exits on the second iteration because the first iteration assigns OrgLocation to 0 (rather than the initially loaded -1)...Then we're setting Alen = 0 after that, and because I get Error Code 9 (System Error) Alen stays set to 0...When it enters the second iteration of the loop both are set to 0 so it exits every time...

I have found that periodically "sleeping" slows the macro down enough to allow Rumba to 'catch up'..I'm just trying to figure out a way to increase the wait where latency is high and decrease when Rumba is running at full speed...

I've added code that will wait an extra 500msec every 10th Send Keystroke command I send...That seems to work for now, just looking for a more precise solution...Thank you again for all your help. Any suggestions are appreciated.