realbasic at nc dot rr dot com wrote:
> dim mb1, mb2 as MemoryBlock
>
> mb1 = newMemoryBlock(1+LenB(sOption))
> mb2 = newMemoryBlock(1+LenB(sValue))
>
> mb1.cstring(0) = sOption
> mb2.cString(0) = sValue
> result = LocalSetOptionValueA(mb1, mb2)
>
> ----------------------------------------------------------------
>
> LocalSetOptionValueA(ByRef mbName as memoryblock, ByRef mbValue as
> memoryBlock) as integer
> Declare Function SetOptionValueA Lib "engine.dll"(Name as ptr, Value
> as ptr) as integer
> dim sPtrName as new MemoryBlock(4)
> dim sPtrValue as new MemoryBlock(4)
>
> sPtrName.Ptr(0) = mbName
> sPtrValue.Ptr(0) = mbValue
All that indirection with the memoryblocks and pointers just recreates the
situation you originally had, with ByRef. Why not share the original code
you're trying to convert? I suspect that things are a lot simpler than they
look.
Mars Saxman
REAL Software
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|