title: Delphi custom message handlers
body: <p>When a user double-clicks a dbgrid, I show a non-modal form.</p>
  
  <p>When they close that form, I want to refresh the grid.</p>
  
  <p>To accomplish that, I have tried the following:</p>
  
  <p>1 - Define a custom message constant:</p>
  
  <pre><code>const
    WM_REFRESH_MSG = WM_USER + 1;  //defined in a globally available unit
  </code></pre>
  
  <p>2 - In the OnClose event of my non-modal form, I have this:</p>
  
  <pre><code>procedure TMyNonModalForm.FormClose(Sender: TObject; var Action: TCloseAction);
  begin
    PostMessage(Self.Handle,WM_REFRESH_MSG,0,0);
  end;
  </code></pre>
  
  <p>3 - In the private declarations of the form that holds the dbGrid, I have this:</p>
  
  <pre><code>procedure OnRefreshRequest(var Msg: TMessage); message WM_REFRESH_MSG;
  
  ...
  
  procedure TMyFormWithADBGrid.OnRefreshRequest(var Msg: TMessage);
  begin
    RefreshGrid;
  end;
  </code></pre>
  
  <p>After doing these things, the PostMessage fires fine, but the OnRefreshRequest procedure never runs.  What am I doing wrong?</p>