bmyers@garnet.berkeley.edu (Brian Myers) (10/13/90)
I'm having trouble with the following program in MacPascal:
program GetWindowTitle;
uses Quickdraw2;
const
WindowList = $9D6;
GetWTitle = $A919;
type
WindowPtr = GrafPtr;
var
wPtr:WindowPtr;
theTitle:str255;
begin
ShowText;
wPtr := pointer( WindowList ) {this is the troublesome line}
InLineP(GetWTitle, wPtr, theTitle);
WriteLn(theTitle);
end.
As I understand it, the problem here is likely to be with the pointer
function, which returns a value that MacPascal thinks points to a single
byte, but what I want is something that will put all four bytes of
the first value of the WindowList in my wPtr variable. I hope I've
said that clearly. (I hope I've understood that clearly!) At any rate,
the last WriteLn produces no output in the Text Window.
MacPascal, a limited educational stripped down Pascal interpreter, does not
let me do things like
type
ptr: ^longint;
begin
x := ptr(somevalue);
I can't do that kind of ad hoc type casting. I do have pointer() and
ord4() functions. Any ideas?
Thanks in advance.
---------------------------------------------------------------------------
Brian Myers bmyers@garnet.berkeley.edu