title: How to not have a MainForm in Delphi?
body: <p>i've been trying to get some modeless forms in my application to appear on the taskbar - taking advantage of the new useful taskbar in Windows 7.</p>
  
  <p>There's are many issues with the VCL that need to be undone before a form can exist on the taskbar.</p>
  
  <p>But the final issue is that minimizing the form that the VCL has designated the <strong>main form</strong> causes all windows in the application to vanish.</p>
  
  <p><a href="http://groups.google.com/group/borland.public.delphi.winapi/msg/85242b2f0e4b8a12?as_umsgid=VA.00007535.009119f0@antispam.compuserve.com&amp;pli=1" rel="nofollow noreferrer">Ten years ago, Peter Below (TeamB) documented these problems</a>, and attempts to work around them. But there are some issues that cannot be solved. The issues run so deep within the VCL itself, that it's effectively impossible to make Delphi applications behave properly.</p>
  
  <p><em>It all stems from the fact that the button you see on the toolbar does not represent the application's window; it represents the <code>TApplications</code> window, which is hidden and never seen. And then there is the application's <code>MainForm</code>, which is then imbued with special abilities where if <strong>it</strong> is minimized then it instructs the application to hide itself.</em></p>
  
  <p>It seems to me that if i can do </p>
  
  <pre><code>Application.MainForm := nil;
  </code></pre>
  
  <p>then all these bugs would go away. The application can have its hidden window, and in the meantime i'll override every <strong><em>other</em></strong> form in the application, including <strong>my</strong> main form, with:</p>
  
  <pre><code>procedure TForm2.CreateParams(var params: TCreateParams ); 
  begin 
     inherited CreateParams(params); 
     params.ExStyle := params.ExStyle or WS_EX_APPWINDOW; 
  end; 
  </code></pre>
  
  <p>But in Delphi the <code>Application.MainForm</code> property is read-only.</p>
  
  <p>How can i not have a <code>MainForm</code> in Delphi?</p>
  
  <h2>See also</h2>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/2204804/delphi-what-is-application-handle">(stackoverflow) Delphi: What is Application.Handle?</a></li>
  <li><a href="http://groups.google.com/group/borland.public.delphi.winapi/msg/85242b2f0e4b8a12?as_umsgid=VA.00007535.009119f0@antispam.compuserve.com&amp;pli=1" rel="nofollow noreferrer">(newsgroup) Hiding Main Window but not child</a></li>
  </ul>