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:
The window is unparented:
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:
Unfortunately, that changes the behavior of my (Delphi) application because there is now two taskbar icons for my application, rather than one:
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?
That icon on the taskbar is the icon of the Application (Handle) rather than that of the MainForm.
Use:
Edit: But out of both your links, I understand you knew that already...duh ;)
This works for the MainForm:
And to hide Application.Handle from the taskbar (to only have a taskbar icon for the MainForm): set the
Visible
property of this Form toTrue
and hide the Application in the project file: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)