Path: utzoo!attcan!uunet!microsoft!michaelt From: michaelt@microsoft.UUCP (Michael Thurlkill 1/1029) Newsgroups: comp.windows.ms Subject: Re: Process priorities in win386 ? Message-ID: <5882@microsoft.UUCP> Date: 8 Jun 89 14:47:03 GMT References: <351@shuldig.huji.ac.il> <11737@polyslo.CalPoly.EDU> Reply-To: michaelt@microsoft.UUCP (Michael Thurlkill 1/1029) Organization: Microsoft Corp., Redmond WA Lines: 45 In article <11737@polyslo.CalPoly.EDU> pdavid@polyslo.CalPoly.EDU (Paul C. David) writes: >oferf%shum.UUCP@humus.Huji.AC.IL (ofer faigon) writes: >>I have two programs - one is a Windows aplication (W), the other a DOS >>application (D). I want to run them together, with W visible and >>covering the whole screen and D in the background. >>At certain times (T) D has to get all or most of the CPU cycles, >>without popping into view. > Try a method outlined in the Petzold book. > Somewhere he writes an application requiring a > background process. He uses PeekMessage to > determine that nothing is in the message queue, > and when it is empty, he dishes off cycles to the > background process (D). Actually, I don't know if this will solve your problem. PeekMessage will work great if you have two Windows apps. If appA uses GetMessage and appB uses PeekMessage, then appB can get all processor time until appA gets a message. So, if you are writing D, the best thing to do would be to make it Windows app, iconize it, and use a PeekMessage loop to poll the queue. However, if this HAS to be a dos app (not something you wrote) then about the best you will do, in the current manifestation of Windows/386 is to have your foreground Windows app call GetMessage. This way, the windows app grabs the processor only when it gets a message, and the background dos app will get a few more time slices. BOOL PeekLoop() { MSG msg; while(TRUE){ if(!PeekMessage(&msg,NULL,0,0,PM_REMOVE)) doSpecialStuff(); else { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } } } Mike Thurlkill Disclaimer: These thoughts are mine, and only mine. These thoughts should in no way be mis-construed as being correct or attributable to anyone but me.