Kbase P76909: How to convert a MEMPTR to a String in Visual Basic
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  1/24/2008 |
|
Status: Verified
GOAL:
How to convert a MEMPTR to a String in Visual Basic
FACT(s) (Environment):
Progress 9.1x
FIX:
In Visual Basic, a MEMPTR comes back as a 'Variant Array of Bytes' so we need to take each byte, convert it to a character, and append it to a string to get the result. The following code shows how to accomplish this:
Private Sub Command1_Click()
Dim oServer As MemptrProxyLib.CMemptrProxy
Dim xDocument As Variant
Dim cDocument As String
Dim iLoop As Long
Set oServer = New MemptrProxyLib.CMemptrProxy
Call oServer.OC_Connect("AppServer://localhost:5162/asbroker1", "", "", "")
Call oServer.MemptrToClient(xDocument)
Call oServer.OC_Release
Set oServer = Nothing
cDocument = Space(UBound(xDocument) + 1)
For iLoop = LBound(xDocument) To UBound(xDocument)
Mid(cDocument, iLoop + 1, 1) = Chr(xDocument(iLoop))
Next iLoop
End Sub