Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!trwind!venice!press From: press@venice.SEDD.TRW.COM (Barry Press) Newsgroups: comp.windows.ms.programmer Subject: Re: What does Yield do? Message-ID: <1095@venice.SEDD.TRW.COM> Date: 16 May 91 16:20:13 GMT References: <1991May16.121553.3876@maytag.waterloo.edu> Reply-To: press@venice.sedd.trw.com (Barry Press) Organization: TRW Systems Engineering & Development Division, Redondo Beach, CA Lines: 27 In article <1991May16.121553.3876@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes: > >I'm porting a DOS program to Windows (using TP for Windows), and am having >trouble getting it to be civilized. It has some long loops where it >occasionally writes to one window; the original never gives up control, >so in Windows everything else comes to a halt until it's done. > >I'm trying to civilize it by putting occasional calls to Yield into the >loop, but it's ignoring mouse events.. If other windows have One of your problems may be that while Yield lets other programs process messages, it doesn't let YOUR program do so. The problem this presents is this: Assume your program has the focus. When some other program is to get the focus, you get sent a message (WM_KILLFOCUS, WM_FOCUS, WM_SETFOCUS, or something along those lines) that tells you you're losing it. If I recall correctly, the other program won't get the focus (and, therefore, process user input) until you process this message. One way to fix this is to put a call not to Yield, but to Peek Message in your loop, where the PeekMessage parameters are set to restrict things to the focus change message. -- Barry Press Internet: press@venice.sedd.trw.com