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 5985427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:31:43+00:00 2026-05-22T22:31:43+00:00

i have a window that i want to minimize (to the taskbar), so i

  • 0

i have a window that i want to minimize (to the taskbar), so i call ShowWindow:

ShowWindow(Handle, SW_MINIMIZE);

Except that rather than minimizing itself (to the taskbar), the window is iconified:

enter image description here

The window is unparented:

enter image description here

How do i minimize a window to the taskbar?


Update:

Following some advice from 2002, i try setting the WS_EX_APPWINDOW window style and/or ensuring the window has no owner:

enter image description here

Unfortunately, that changes the behavior of my (Delphi) application because there is now two taskbar icons for my application, rather than one:

enter image description here

This, of course, is an artifact of Delphi (5); and because i was trying to solve another issue.

But that shouldn’t affect this question. i’m calling the ShowWindow(..., SW_MINIMIZE) API, and rather than minimize the window Windows is iconifying the application.

How do i minimize a window to the taskbar?

  • 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-05-22T22:31:43+00:00Added an answer on May 22, 2026 at 10:31 pm

    That icon on the taskbar is the icon of the Application (Handle) rather than that of the MainForm.

    Use:

    Application.Minimize;
    

    Edit: But out of both your links, I understand you knew that already…duh 😉

    This works for the MainForm:

    TForm1 = class(TForm)
    private
      procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
    protected
      procedure CreateParams(var Params: TCreateParams); override;
    
    ...
    
    procedure TForm1.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);
      with Params do
      begin
        ExStyle := ExStyle or WS_EX_APPWINDOW;
        WndParent := GetDesktopWindow;
      end;
    end;
    
    procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
    begin
      if Msg.CmdType = SC_MINIMIZE then
        ShowWindow(Handle, SW_MINIMIZE)
      else
        inherited;
    end;
    

    And to hide Application.Handle from the taskbar (to only have a taskbar icon for the MainForm): set the Visible property of this Form to True and hide the Application in the project file:

    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    ShowWindow(Application.Handle, SW_HIDE);
    Application.Run;
    

    For this form, ShowWindow(Handle, SW_MINIMIZE); shóuld work. It also provides for the default zooming-feature of Windows when minimizing or restoring.

    (Tested with D5 & D7 on XP and W7)

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

Sidebar

Related Questions

I have a HUD window that has some labels on it, and I want
I have a main window, that opens another window. I want to close this
I have a WinForm that I want to minimize when the x in the
I want to minimize all application that are running in the system, except mine.
I have a WPF window that I want replaced with another user control on
I want to have a window that the User can resize, and I want
I have an application that launches Notepad. What I want to do is minimize
I have a figure window and I want to remove the maximize/minimize and close
I have 2 windows now that i want to open maximized but should be
I have a C# Windows application that I want to ensure will show up

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.