🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages Started by Gary Setter Fri, 18 Apr 2003 12:46
How to trigger on enter idle state.
#16974
Author: Gary Setter
Date: Fri, 18 Apr 2003 12:46
23 lines
1957 bytes
Hi,

I'm trying to better understand the Win32 api by making a MDI application
with toolbar support.

The problem I'm facing at the moment is enabling/disabling tool bar buttons.
I can do the enable/disable check by setting a timer and processing the
event. However, when the application is idle, I would rather that no
messages be processed.

I see that class libraries use a IdleAction function to enable/disable after
other messages are processed. This seems like what the WM_ENTERIDLE message
is about.  I tried to use it for enable/disable, but it doesn't get
triggered at all the times I would like. I guess that is why the class
library
IdleAction code is not trivial. (at least no for me )

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?

Thanks,
Gary
Re: How to trigger on enter idle state.
#16881
Author: Asger J�rgensen
Date: Fri, 18 Apr 2003 15:44
10 lines
1043 bytes
Hi Gary Setter

There is a TFormIdle component at this page:

http://www.mitov.com/Dwnd/dwnd.html

With full source and free

Best regards
Asger
Re: How to trigger on enter idle state.
#16890
Author: Chris
Date: Sat, 19 Apr 2003 10:25
21 lines
1650 bytes
---- Original Message -----
From: "Gary Setter" <setterg@worldnet.att.net>
Newsgroups: borland.public.cppbuilder.nativeapi

> 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?

Not sure if this is a way you would want to do it but I simply do this

in header
void __fastcall MyIdleHandler(TObject *Sender, bool &Done);

in constructor
Application->OnIdle = MyIdleHandler;

Works great for me.

Chris
Re: How to trigger on enter idle state.
#16906
Author: Gary Setter
Date: Sat, 19 Apr 2003 12:58
20 lines
1475 bytes
"Asger J�rgensen" <Asger.Pnotthis@AJ-World.dk> wrote in message
news:MPG.190a3bc8299f2cf59896e6@newsgroups.borland.com...
> Hi Gary Setter
>
> There is a TFormIdle component at this page:
>
> http://www.mitov.com/Dwnd/dwnd.html
>
> With full source and free
>
> Best regards
> Asger

Thanks Asger,

I was trying to learn do without the class libs and learn the Win32 api.

Best regards,
Gary
Re: How to trigger on enter idle state.
#16907
Author: Gary Setter
Date: Sun, 20 Apr 2003 12:32
21 lines
1431 bytes
<snip> Not sure if this is a way you would want to do it but I simply do
this
>
> in header
> void __fastcall MyIdleHandler(TObject *Sender, bool &Done);
>
> in constructor
> Application->OnIdle = MyIdleHandler;
>
> Works great for me.
>
> Chris
>

Thanks Chris,

I was trying to learn do without the class libs and learn the Win32 api.

Best regards,
Gary
Re: How to trigger on enter idle state.
#16875
Author: Damon Chandler (TeamB)
Date: Wed, 23 Apr 2003 07:38
31 lines
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
Re: How to trigger on enter idle state.
#16788
Author: Gary Setter
Date: Wed, 23 Apr 2003 12:36
23 lines
1722 bytes
"Damon Chandler (TeamB)" <dmc27@cornell.edu> wrote in message
news:3EA64309.35FCF464@cornell.edu...
<snip>  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

Thanks Damon,

That definitely helps.
Gary
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads