where to put : while GetMessage(theMessage,0,0,0) in Vcl form!

i go an example about how to get message always on/with API programming. It say that we just put:


bla...

begin //main
.. //Create window
.. //update window
.. //etc

while GetMessage (TheMessage,0,0,0) do
begin
TranslateMessage (theMessage);
DispatchMessage (TheMessage);
end;

end.

before the end of main part (like main in C++)

but how to put that thing (while part) in vcl? where is the main part that will always execute?

I have try to put that on event Form.OnCreate....
but, it end with error (the form never show!)

Thank You!

Comments

  • : i go an example about how to get message always on/with API programming. It say that we just put:
    :
    :
    : bla...
    :
    : begin //main
    : .. //Create window
    : .. //update window
    : .. //etc
    :
    : while GetMessage (TheMessage,0,0,0) do
    : begin
    : TranslateMessage (theMessage);
    : DispatchMessage (TheMessage);
    : end;
    :
    : end.
    :
    : before the end of main part (like main in C++)
    :
    : but how to put that thing (while part) in vcl? where is the main part that will always execute?
    :
    : I have try to put that on event Form.OnCreate....
    : but, it end with error (the form never show!)
    :
    : Thank You!
    :
    :
    The C++ Main() routine in the vcl is deeply embedded into the TApplication object and the underlying event handling. The easiest way to handle messages is to assign a method to the TApplication.OnMessage(). All windows messages will be handled as follows:
    - TranslateMessage()
    - OnMessage()
    - DispatchMessage() to appropriate control.
    The various parameters of the OnMessage() event allow you to disable the message handling or to modify the message.
  • i've try it, and it's works!!

    Thank You Zib!!!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories