Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.10.03;
Скачать: CL | DM;

Вниз

Idle   Найти похожие ветки 

 
anod ©   (2002-08-14 23:10) [0]

Приведите пожалуйста пример как реализовать Idle. Надо обрабатывать сообщение WM_ENTERIDLE, но как его вызвать...


 
Raptor ©   (2002-08-14 23:45) [1]

А для чего его вызывать? Винда сама его вызывает если в очереди сообщений окна нет необработаных сообщений. Просто описываешь обработку WM_ENTERIDLE в процедуре окна и все.


 
anod ©   (2002-08-15 00:54) [2]

Нет наверное мне нужен не Idle. мне нужен постоянный цикл, типа таймера, чтобы все время работы программы работал и он??


 
anod ©   (2002-08-15 00:57) [3]

Я для проверки сделал так:
WM_ENTERIDLE:begin
ShowMessage("11");
end;
мессага показывалась только тогда, когда происходили события (например нажатие кнопки или вызов системного меню)


 
watcher   (2002-08-15 13:33) [4]

TApplication.OnIdle

Occurs when an application becomes idle.

type TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
property OnIdle: TIdleEvent;

Description

Write an OnIdle event handler to perform special processing when an application is idle. An application is idle when it is not processing code. For example, an application is idle when it is waiting for input from the user.

The TIdleEvent type is the type of the OnIdle event. TIdleEvent has a Boolean parameter Done that is True by default. When Done is True, the application allows all action components to update themselves after the OnIdle event handler returns. After updating the actions, the application calls the Windows API WaitMessage, which yields control to other applications until a new message appears in the message queue of the application. When Done is False, the application actions do not receive an OnUpdate event and the application does not yield control to other applications while it is not busy.

OnIdle is called only once, as the application transitions into an idle state. It is not called continuously unless Done is set to False. Applications that set Done to False consume an inordinate amount of CPU time, which affects overall system performance.

Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE.


 
anod ©   (2002-08-15 15:12) [5]

К чему это???


 
DiamondShark ©   (2002-08-15 23:18) [6]

А в основном цикле приложения?
Только использовать не GetMessage, а PeekMessage


 
Raptor ©   (2002-08-15 23:33) [7]

2 watcher
Если ты не в курсе то здесь форум по WinAPI.

2 anod

> Нет наверное мне нужен не Idle. мне нужен постоянный цикл,
> типа таймера, чтобы все время работы программы работал и
> он??

Так постоянный цикл или таймер? Если постоянный цикл, то тогда делай как сказал DiamondShark или сделай отдельную нить. Если таймер, то сделай таймер (SetTimer), только не через WM_TIMER, а через указание callback-процедуры таймера.



Страницы: 1 вся ветка

Текущий архив: 2002.10.03;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.017 c
1-8054
dim-
2002-09-22 13:20
2002.10.03
компоненты


14-8176
Lamer86
2002-09-04 21:23
2002.10.03
Как узнать IP человека, который написал мне письмо?


1-8059
123000
2002-09-21 16:34
2002.10.03
Как включить и выключить монитор?


3-7857
iif
2002-09-13 11:16
2002.10.03
Lookup-поле с LookupDataset из другой БД


1-7895
alxx
2002-09-20 18:28
2002.10.03
Checkbox ы в TListView