Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read string from handle
Message
De
25/10/2010 06:06:03
 
 
À
25/10/2010 05:52:47
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01486821
Message ID:
01486825
Vues:
34
>>>Hi all,
>>>
>>>so the days second riddle.
>>>
>>>I have a dll that returns a string in an handle.
>>>
>>>It gives me the handle as well as the len of the string.
>>>
>>>Simple question:
>>>How do i get my string?
>>>
>>>TIA
>>>
>>>Agnes
>>
>>see sys(2600) first example
>>
>>There's another solution with api
>
>Hm,
>
>this returns garbage.
>
>Is handler the same is pointer in this context?
>
>even the C example does something with globallock etc
>
>from the VB
>
>        If bcRESULT2.pBC_TwoDimRes.hBC_TwoDimRes <> 0 Then
>            h2DResult = 0
>            h2DResult = GlobalLock(bcRESULT2.pBC_TwoDimRes.hBC_TwoDimRes)
>            If h2DResult = 0 Then
>                sResult = sResult + TXT_ERROR_RESULT_2DIM_NOACCESS + vbCrLf
>            Else
>                s2DResult = String(bcRESULT2.pBC_TwoDimRes.iBC_TwoDimLen + 1, Chr(0))
>                Call CopyMemory(ByVal s2DResult, ByVal h2DResult, bcRESULT2.pBC_TwoDimRes.iBC_TwoDimLen)
>                s2DResult = Left(s2DResult, bcRESULT2.pBC_TwoDimRes.iBC_TwoDimLen)
>                sResult = sResult + qsTrim(s2DResult) + vbCrLf
>                bcData = qsTrim(s2DResult)
>                GlobalUnlock (h2DResult)
>            End If
>            GlobalFree (bcRESULT2.pBC_TwoDimRes.hBC_TwoDimRes)
>            bcRESULT2.pBC_TwoDimRes.hBC_TwoDimRes = 0
>        Else
>....
>        End If
>
>
>Agnes
>
>Update,
>
>ah, I ifound the declaration. I will give it a try.

If all fails
declare RtlMoveMemory in Kernel32 string @dest, long src, long bytesToCopy

local s
s = repl(chr(0), theLength+1 )
=RtlMoveMemory(@m.s, thePointer, theLength)

s = rtrim(m.s, chr(0))
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform