Why is this code working only in 32 bit?

Marnaud <[email protected]>
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
Hello,

I have this code, which, for a given AppleEvent, retrieves its error code:

Public Function GetAEReplyError(theevent As AppleEvent) as Integer
  #if TargetMacOS then
    dim i,j,k As Integer
    dim s As OSType
    
    If theEvent Is Nil then Return 0
    
    If theEvent.ReplyPtr=0 then Return 0
    
    dim replyEvent as new MemoryBlock(4)
    replyEvent.Long(0)=theEvent.ReplyPtr
    replyEvent=replyEvent.Ptr(0)
    
    If replyEvent.Size>-1 and StrComp(replyEvent.StringValue(0, 4), "null",0)=0 then Return 0
    
    Soft Declare Function AESizeOfParam Lib "Carbon.framework" (theAppleEvent as Integer,theAEKeyword as OSType,typeCode as Integer,dataSize as Integer) as Short
    
    If AESizeOfParam(theEvent.ReplyPtr,"errn",0,0)<>0 then Return 0//because an error code has not been set
    
    Soft Declare Function AEGetParamPtr Lib "Carbon.framework" (theAppleEvent as Integer,theAEKeyword as OSType,typeCode as OSType,ByRef actualType as OSType,ByRef dataPtr as Integer,MaxSize As Integer,ByRef DataSize As Integer) as Short
    k=AEGetParamPtr(theEvent.ReplyPtr,"errn","long",s,i,4,j)
    Return i
  #endif
End Function

In 32 bit, it works flawlessly, but in 64 bit, replyEvent has a size of -1 after the line “replyEvent=replyEvent.Ptr(0)” and I don’t understand why. May someone help, please?


To unsubscribe, email [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.