Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!news.miami.edu!umiami!dweisman From: dweisman@umiami.ir.miami.edu (Ordinary Man) Newsgroups: comp.sys.mac.programmer Subject: Re: window Message-ID: <1991May9.130911.9763@umiami.ir.miami.edu> Date: 9 May 91 17:09:10 GMT References: <1991May9.074917.19604@midway.uchicago.edu> Organization: Univ of Miami IR Lines: 33 In article <1991May9.074917.19604@midway.uchicago.edu>, hui@landau.uchicago.edu (Hui Dong) writes: > > I am new to mac programming, this maybe a trivial question but I need > help. How to get the WindowRecord from a WindowPtr? Someone suggest > (WindowPeek)mywindow but it doesn't seem to work, and how to find the current > front window(active one)? Thank you very much. Yeah, that *IS* the correct way to get at the WindowRecord of a window. I think the correct way to typecast is: var windRec:WindowRecord; begin ... windRec:=WindowPeek(yourWindowPtr); ... end; You could also pass a pointer to the window's record when it gets created using (Get)NewWindow and setting the wStorage parameter to your window record. The Window Manager function FrontWindow will return the currently active window (i.e. if myWindow=FrontWindow then ...). Dan /-------------------------------------------------------------------------\ | Dan Weisman - University of Miami - Florida | || || || || | |--------------------------------------------------| || || ||\ /|| | | INTERNET -----> dweisman@umiami.IR.Miami.edu | || || || | || | | BITNET -----> dweisman@umiami | ||||||| || | || | |-------------------------------------------------------------------------| | "The more I get to see, the less I understand..." - Triumph | \_________________________________________________________________________/