home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pctchnqs
/
1991
/
number6
/
apprun.src
next >
Wrap
Text File
|
1991-11-11
|
908b
|
25 lines
{ Listing 3: A simplified (no translations) message loop }
procedure Application.Run
var
Backgrnd: pointer;
Message: TMessage;
begin
Backgrnd := Dynamic(TypeOf(Self), di_Background);
{ "di" for "dynamic index", of course. (When in Windows, name }
{ like Windows.) I use $7FFF, as it seems rather unlikely that }
{ any app will ever need to define so many internal messages. }
if (@ Application.Background) = Backgrnd
{Is there a BACKGROUND method that actually does anything?}
then while GetMessage(Message, 0, 0, 0) do
{Nothing but respond to events}
DispatchMessage(Message)
else repeat
{Respond to events AND do background processing}
if PeekMessage(Message, 0, 0, 0, pm_Remove)
then DispatchMessage(Message)
else NiladicMethod(Backgrnd)(Self);
{Cheaper to do DMT lookup _once_}
until Message.Message = wm_Quit;
end;