On Mar 31, 2005, at 11:04 AM, Aaron Ballman wrote:
Declare Function SetOptionValueA Lib "engine.dll"(ByRef Name as
cstring, ByRef Value as cstring) as integer
return SetOptionValueA(mb1,mb2)
mb1 & mb2 are memory blocks, assigned in this manner:
mb1 = newMemoryBlock(1+LenB(sName))
mb2 = newMemoryBlock(1+LenB(sValue))
mb1.cstring(0) = sName
mb2.cString(0) = sValue
It's asking for a ByRef string, which is really a pointer to a string.
So you're missing one easy step:
dim strPtrName as new MemoryBlock( 4 )
strPtrName.Ptr( 0 ) = mb1
dim strPtrValue as new MemoryBlock( 4 )
strPtrValue.Ptr( 0 ) = mb2
SetOptionValue( strPtrName, strPtrValue )
Don't forget to turn the ByRef Name as CString into just Name as Ptr
(same for Value), and things should work.
Thanks Aaron, but it is still crashing. Below is the code now, am I
missing something?
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
return SetOptionValueA(sPtrName,sPtrValue)
Christian
Pariahware, Inc. Custom Software
<pariahware at pariahware dot com>
<http://www.pariahware.com>
--
God loved you so much that He gave His only son Jesus. What have you
done with God's gift?
_______________________________________________
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>
|