Solved

Cannot hide App button on Taskbar with Delphi 2007

Posted on 2007-11-14
7
2,109 Views
Last Modified: 2008-03-26
I cannot hide the app button on the windows taskbar in Delphi 2007.  This is the method that has worked for up till now.

procedure TMainForm.FormCreate(Sender: TObject) ;
begin
  ShowWindow(Application.Handle, SW_HIDE) ;
  SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW ) ;
  ShowWindow(Application.Handle, SW_SHOW) ;
end;


0
Comment
Question by:Jebtrix
7 Comments
 
LVL 2

Author Comment

by:Jebtrix
ID: 20284347
Let me elaborate on that a little. I can get it to 'work' in FormActivate, but as soon as this line is executed the button reappears:

ShowWindow(Application.Handle, SW_SHOW) ;

This worked fine in Delphi 7.  Just need to know what changed in D2007 that messes this up.

0
 
LVL 25

Expert Comment

by:imitchie
ID: 20284737
how about

ShowWindow(Self.Handle, SW_SHOW) ;
0
 
LVL 2

Author Comment

by:Jebtrix
ID: 20350263
I found a working solution:

Application.MainFormOnTaskbar := False;
//This must be set in the application file before any form is created

ShowWindow(Application.Handle, SW_HIDE) ;
//Must use in either OnActivate or OnShow event as OnCreate is a no go now.

Problem is that it still appears momentarily but I think I just have to move some I/O operations out of OnCreate that induce slight delays.

The reason the tried and true way doesn't work anymore is CodeGear had to radically change the handling of forms for Vista. My academic question for now is how to hide the app in taskbar with Application.MainFormOnTaskbar := True; (which is default)

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 25

Expert Comment

by:imitchie
ID: 20354194
I haven't actually got my Delphi2007 machine with me, but I'm still curious:
why is it

ShowWindow(Application.Handle, SW_SHOW) ; << the special "Application" window

instead of

ShowWindow(Self.Handle, SW_SHOW) ; << the main form
0
 

Expert Comment

by:Dream-
ID: 20677506
I have been looking for a solution as well. The only thing I have managed to do is just as Jebtrix said, to hide the application window taskbar button at OnShow or OnActivate. The problem is that is does show the button for a second.

There has to be a way to get this working.

One thing I found is that the problem appears at Application.Run. It seems this method unhides the application window. The method code did change in D2007.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 21216651
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
add combobox item based on numbers 9 99
Printing problem 2 72
Run video youtube webbrowse 10 45
control image tags in a string ? 12 62
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now