Board index » delphi » Help: writing well behaved Delphi or C++ Builder apps

Help: writing well behaved Delphi or C++ Builder apps

I want to make a well behaved batch program for Win95  using C++
Builder or Delphi.
This requires that a regularly leave my processing loop, give control
back to Windows and continue after getting control again.

The latter is, i know,  archieved by issuing a Windows message to be
handled by my own progam.

How can i do:
a)   issue a message to Windows
b)  handle the message by my program

Can anybody help me ?

Tom Nieuwenhuizen

 

Re:Help: writing well behaved Delphi or C++ Builder apps


Quote
Tom Nieuwenhuizen wrote:

> I want to make a well behaved batch program for Win95  using C++
> Builder or Delphi.
> This requires that a regularly leave my processing loop, give control
> back to Windows and continue after getting control again.

        The generic message-loop stuff is set up and handled
utomatically by Delphi. Everything else I say here refers to
Delphi:

Quote
> The latter is, i know,  archieved by issuing a Windows message to be
> handled by my own progam.

        ??? I thought the traditional thing was to call PeekMessage
or some such, not to _send_ a message. Anyway: You usually don't need
to worry about this. If you're in the middle of a long loop and you
want to get messages (say from a cancel button) you simply call

Application.ProcessMessages;

inside your loop.

Quote
> How can i do:
> a)   issue a message to Windows

        ??? You don't send messages to Windows, you send messages
to windows, using SendMessage or PostMessage. (You can send a
message to all the top-level windows by using HWND_BROADCAST
for the window handle.)

Quote
> b)  handle the message by my program

        You can define a message-handler by using the keyword
"message" (look up "message" in the docs for details). You can
also set the value of Application.OnMessage.

--
David Ullrich

sig.txt not found

Re:Help: writing well behaved Delphi or C++ Builder apps


Tom Nieuwenhuizen <nieuw...@xs4all.nl> escreveu no artigo
<340b1269.664...@news.xs4all.nl>...

Quote
> I want to make a well behaved batch program for Win95  using C++
> Builder or Delphi.
> This requires that a regularly leave my processing loop, give control
> back to Windows and continue after getting control again.

Tom,

Try Application.ProcessMessages.
Regards,

Other Threads