Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:29:01+00:00 2026-06-17T09:29:01+00:00

I have a program where it will not start minimized and shows a very

  • 0

I have a program where it will not start minimized and shows a very small window on the dekstop.

Image: https://i.stack.imgur.com/aFc6o.jpg

Code:

program:

program Project4;

uses
  Forms,
  Unit4 in 'Unit4.pas' {Form4};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := false;
  Application.ShowMainForm:=false;
  Application.CreateForm(TForm4, Form4);
  Application.Run;
end.

unit:

unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, AppEvnts, ExtCtrls, Menus;

type
  TForm4 = class(TForm)
    TrayIcon1: TTrayIcon;
    ApplicationEvents1: TApplicationEvents;
    PopupMenu1: TPopupMenu;
    Exit1: TMenuItem;
    procedure TrayIcon1DblClick(Sender: TObject);
    procedure ApplicationEvents1Minimize(Sender: TObject);
    procedure ApplicationEvents1Restore(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormCreate(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
  private
    { Private declarations }
    fCanClose: Boolean;
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

procedure TForm4.ApplicationEvents1Minimize(Sender: TObject);
begin
  Hide();
  WindowState := wsMinimized;
end;

procedure TForm4.ApplicationEvents1Restore(Sender: TObject);
begin
  Show();
  WindowState := wsNormal;
  application.Bringtofront;
end;

procedure TForm4.Exit1Click(Sender: TObject);
begin
  fcanclose:=true;
  close;
end;

procedure TForm4.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  if not fCanClose then
    begin
      hide;
      windowstate:=wsminimized;
      CanClose:=false;
    end
      else
    CanCLose:=True;
end;

procedure TForm4.FormCreate(Sender: TObject);
begin
  fCanClose:=FALSE;
end;

procedure TForm4.TrayIcon1DblClick(Sender: TObject);
begin
  if (windowstate = wsminimized) then
    begin
      Show;
      windowstate := wsnormal;
      application.BringToFront;
    end
     else
    begin
      hide;
      windowstate:=wsminimized;
    end;
end;

end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:29:02+00:00Added an answer on June 17, 2026 at 9:29 am

    I created your project and had the same problems until I changed the following line of code to True:

    Application.MainFormOnTaskbar := True;
    

    Now the app seems to work just fine without an minimizing to the bottom left corner of the desktop before it is hidden.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have getRuntime().exec() calls in my program; however, two of them will not work:
I have a program that will let me manage users on our terminal server
I have the below program that will move files from one directory to other.
I have a java program that will work with a variety of Java Beans.
I have developed a Java program that will count the number of files in
I have a program and want to debug it in gdb. Will I see
How to write a java program which will tell me whether I have internet
For a school assignment I have to create a C++ program that will create
what will the program behave when they have two exceptions. And none of them
I have a C++ program which, during execution, will allocate about 3-8Gb of memory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.