Solved

Cannot hide App button on Taskbar with Delphi 2007

Posted on 2007-11-14
7
2,115 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

775 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