Hi,
I am trying to transfer data from a visual basic application to a progress application. The data could be extensive so I don't want to use input output params etc. I have thought of loading the data into memory within the Visual basic app and passing the memory pointer to the progress app so progress can retrieve the data.
The Vb code below works fine and stores/retrieves the test data. I then pass the memptr as an integer to progress. Progress then does not return any data. I think it is because the memptr has been passed to progress as an integer. Is there a way of passing progress the actual memory pointer without any conversion?
Progress Version 9.1C25
Thanks in Advance
The vb code I am using is
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" (Destination As Any, _
Source As Any, ByVal Length As Long)
Private Declare Sub CopyMemoryWrite Lib "kernel32" Alias _
"RtlMoveMemory" (ByVal Destination As Long, Source As Any, _
ByVal Length As Long)
Private Declare Sub CopyMemoryRead Lib "kernel32" Alias _
"RtlMoveMemory" (Destination As Any, ByVal Source As Long, _
ByVal Length As Long)
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" _
(ByVal hHeap As Long, ByVal dwFlags As Long, _
ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" _
(ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Public Function GetAlphaName(ByVal P_LETTER As String) As Long
Dim ptr As Long
Dim hHeap As Long
hHeap = GetProcessHeap()
ptr = HeapAlloc(hHeap, 0, 2)
If ptr <> 0 Then
Dim testtext As String
testtext = "TEST"
CopyMemoryWrite ptr, CStr(testtext), 2
testtext = ""
CopyMemoryRead testtext, ptr, 2
MsgBox "The Address of ptr is " & CStr(ptr) & vbCrLf & "and the value is " & testtext
GetAlphaName = ptr
End If
Progress code:
/* defined in definitions block */
Procedure RtlMoveMemory External "kernel32":
Def output param destination as char.
Def input param source as long.
Def input param length as long.
End procedure.
Define var P-ENTRY As integer No-undo.
Def var mymemptr as integer no-undo.
Def var mystring as char.
P-ENTRY = V-OBJSESSION:getAlphaName ( P-LETTER ).
Run RtlMoveMemory (output mystring, p-entry, 2).
message mystring.
I am trying to transfer data from a visual basic application to a progress application. The data could be extensive so I don't want to use input output params etc. I have thought of loading the data into memory within the Visual basic app and passing the memory pointer to the progress app so progress can retrieve the data.
The Vb code below works fine and stores/retrieves the test data. I then pass the memptr as an integer to progress. Progress then does not return any data. I think it is because the memptr has been passed to progress as an integer. Is there a way of passing progress the actual memory pointer without any conversion?
Progress Version 9.1C25
Thanks in Advance
The vb code I am using is
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" (Destination As Any, _
Source As Any, ByVal Length As Long)
Private Declare Sub CopyMemoryWrite Lib "kernel32" Alias _
"RtlMoveMemory" (ByVal Destination As Long, Source As Any, _
ByVal Length As Long)
Private Declare Sub CopyMemoryRead Lib "kernel32" Alias _
"RtlMoveMemory" (Destination As Any, ByVal Source As Long, _
ByVal Length As Long)
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" _
(ByVal hHeap As Long, ByVal dwFlags As Long, _
ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" _
(ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Public Function GetAlphaName(ByVal P_LETTER As String) As Long
Dim ptr As Long
Dim hHeap As Long
hHeap = GetProcessHeap()
ptr = HeapAlloc(hHeap, 0, 2)
If ptr <> 0 Then
Dim testtext As String
testtext = "TEST"
CopyMemoryWrite ptr, CStr(testtext), 2
testtext = ""
CopyMemoryRead testtext, ptr, 2
MsgBox "The Address of ptr is " & CStr(ptr) & vbCrLf & "and the value is " & testtext
GetAlphaName = ptr
End If
Progress code:
/* defined in definitions block */
Procedure RtlMoveMemory External "kernel32":
Def output param destination as char.
Def input param source as long.
Def input param length as long.
End procedure.
Define var P-ENTRY As integer No-undo.
Def var mymemptr as integer no-undo.
Def var mystring as char.
P-ENTRY = V-OBJSESSION:getAlphaName ( P-LETTER ).
Run RtlMoveMemory (output mystring, p-entry, 2).
message mystring.