Hi Thomas,

I had to dig out an old project to find Addressof code. I was using the 
PTR returned by AddressOf as part of a memoryblock that I passed to a 
declare. My code looked like this:

    ABD = new memoryblock(36)
    ///APPBARDATA structure
    ABD.long(0) = ABD.size
    ABD.long(4) = self.winhwnd
    ABD.ptr(8) = AddressOf app.WndProc
    ABD.long(12) = ABE_TOP
    ABD.long(16) = 0  'left
    ABD.long(20) = 60 'top
    ABD.long(24) = screen(0).availablewidth 'right
    ABD.long(28) = 100 'bottom
    ABD.long(32) = ABS_ALWAYSONTOP

I was using the memory block to manually create a struct. I'm not sure 
exactly how yours needs to look, but maybe this will be of some help. 
Perhaps you could create your SampleStruct as a memoryblock instead and 
then use PTR.

Brian


Thomas Cunningham wrote:

>No idea's for me? :-( Thank you.
>
>  
>
>>I was looking for a little clarification on using callbacks, memoryblocks
>>and declares. I thought I understood these concepts better  - ugh!. :-)
>>
>>This is all placed in a module, assume this structure.
>>
>>typedef struct SampleStruct{
>>version As Integer
>>evaluate As Integer
>>}
>>
>>The evaluate declaration in this structure is a callback used to evaluate a
>>function. I assume this needs to be declared as an integer since we cannot
>>declare it in a structure as a MemoryBlock.
>>
>>I want to assign to this evaluate property. I have this in a routine,
>>
>>Dim aSampleStruct As SampleStruct
>>aSampleStruct.version = 2.0
>>aSampleStruct.evaluate = AddressOf SampleCallbackRoutine
>>
>>Since AddressOf returns a Memoryblock, this last line will not compile. How
>>can I get around this?
>>
>>I have tried this, but is this correct?
>>
>>Dim aSampleStruct As SampleStruct
>>aSampleStruct.version = 2.0
>>Dim temp As New MemoryBlock(4)
>>temp = AddressOf SampleCallbackRoutine
>>aSampleStruct.evaluate = temp.Long(0)
>>
>>And what role does the MemoryBlock Ptr property  play in this?
>>
>>Oh and once this structure is filled, I will be passing it to a declare that
>>has this prototype declared as,
>>
>>const CGFunctionCallbacks *callbacks
>>
>>Thank you for any clarifications! It would be nice to be able to inspect
>>these items of the memoryblock class in the debugger.
>>
>>    
>>
>  
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to