next up previous contents
Next: How to define a Up: How to implement a Previous: Windows Message   Contents

Message loop

All applications, if idle, are in a loop that checks if there are new Windows messages. By incoming messages, the loop calls the corresponding function. If we want to create our own inter-process message WMsgGPUResult, we will need to override the WndProc procedure called by the loop and listen in for the new message type we defined [6].

TForm1 = class(TForm) 
    ... 
  public 
    procedure WndProc(var TheMsg: TMessage); override; 
  end; 

procedure TForm1.WndProc(Var TheMsg: TMessage); 
begin 
  if TheMsg.Msg = WMsgGPUResult then 
    begin 
      {It is our custom message - deal with it!} 
    end; 
  Inherited WndProc(TheMsg); 
end;



Tiziano Mengotti 2004-03-27