Article View: borland.public.cppbuilder.nativeapi
Article #16875Re: How to trigger on enter idle state.
From: Damon Chandler (TeamB)
Date: Wed, 23 Apr 2003 07:38
Date: Wed, 23 Apr 2003 07:38
31 lines
2525 bytes
2525 bytes
Hi Gary, > I'm trying to better understand the Win32 api by making a MDI > application with toolbar support. [...] > Has anyone out there been thinking about how to trigger on the > entering the idle state? Does windows post WM_ENTERIDLE at the > right time? Is there a better way to trigger on enter idle state? IIRC, the WM_ENTERIDLE message is used mainly with dialog boxes and menus. An application is traditionally considered "idle" when its message queue is empty. You can use the PeekMessage() function to determine if there are any messages in the queue; the function will return zero if there are no messages, indicating an idle state. The TApplication class, for example, calls the PeekMessage() function from within its main message-processing loop [embedded within TApplication::Run()]: if PeekMessage() returns non-zero, the message is dispatched and processed; if PeekMessage() returns zero, various idle-related events are fired (e.g., TApplication::OnIdle, TCustomForm::UpdateActions). If you're creating a VCL application, stick with the TAction and TActionList classes. If you're creating a pure API application, you'd call PeekMessage() within your message-processing loop to determine whether to process the message [e.g., via GetMessage()*] or whether to call your "OnIdle" code. * You'd call GetMessage() if you used PM_NOREMOVE with PeekMessage(); if you use PM_REMOVE, you've already removed the message from the queue so you'd call TranslateMessage() and DispatchMessage() directly. HTH, -- Damon (TeamB) BCBCAQ--http://bcbcaq.bytamin-c.com
Technical Details
Message-ID:
<3EA64309.35FCF464@cornell.edu>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e9ff495@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,299952604d3f7245 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-23 00:46:41 PST Message-ID: <3EA64309.35FCF464@cornell.edu> Date: Wed, 23 Apr 2003 03:38:49 -0400 From: "Damon Chandler (TeamB)" <dmc27@cornell.edu> X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: How to trigger on enter idle state. References: <3e9ff495@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.92.234.87 X-Trace: newsgroups.borland.com 1051083454 24.92.234.87 (23 Apr 2003 00:37:34 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail