WindowPtr
From REALbasicWiki
WindowPtr was originally a datatype for use only in declarations. The compiler would let you assign a Window variable to a parameter of type WindowPtr, and the effect of this was to pass the Window's MacWindowPtr property to the parameter. As a consequence of improvements to the REALbasic language, there are no more declare-only datatypes. WindowPtr appears to continue to exist mostly for backward compatibility.
The WIndow class has a method Operator_Convert() as WindowPtr that appears to return the value of Window.Handle. When you declare a parameter as WindowPtr, this method is called at runtime. Here is an example declaration.
Declare Function IsWindowModified Lib "Carbon.framework" (w as WindowPtr) as Boolean
In code, you might write
return IsWindowModified(self)
The compiler will allow you to pass Nil to a parameter of type WindowPtr, and the effect is that 0 is passed to the function. But you cannot pass a nil Window reference; this results in a NilObjectException. Presumably the reason is that if you pass a nil reference, the compiler generates a call to Operator_Convert, and this will fail at runtime.
