Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read string from handle
Message
 
 
À
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:
01486826
Vues:
79
This message has been marked as the solution to the initial question of the thread.
Try
DECLARE LONG GlobalLock IN WIN32API LONG HMEM
DECLARE LONG GlobalUnlock IN WIN32API LONG HMEM

lhMem = bcRESULT2.pBC_TwoDimRes.hBC_TwoDimRes

IF lhMem <> 0
  lnPtr = GlobalLock(lhMem)
  IF lnPtr <> 0	
    lnLen = bcRESULT2.pBC_TwoDimRes.iBC_TwoDimLen
    lcResult = SYS(2600, lnPtr, lnLen)
    =GlobalUnlock(lhMem)
  ENDIF
ENDIF
>>>
>>>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.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform