Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Optimization
Expertise: Beginner
Aug 26, 1998



Application Security Testing: An Integral Part of DevOps

Don't Show Form at Startup of System Tray App

I tried your procedure for placing my application on the system tray and it works fine. My problem is that it opens the form1 when the application is executed, but I do not want to open it until the user clicks on the menu item on the right-click menu of the system tray icon.

Any help will be greatly welcome.

The easiest way to have the form not show up is to do the following:

1) Define a Boolean variable in the private section of your form's type declaration —let's call it FrmCreate.

2) In the Form's OnCreate, set FrmCreate to True.

3) Next, drop a TTimer on the form and in its OnTimer event, write the following:

procedure TMainForm.Timer1Timer(Sender: TObject);
  if FrmCreate then begin
    ShowWindow(MainForm.Handle, SW_HIDE);
    Timer1.Enabled := False;
The timer is only active at create time so you can just hide the window as soon as it pops up. This will probably cause a bit of a flash, but that's usually not a big deal.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date