Solved

Cannot hide App button on Taskbar with Delphi 2007

Posted on 2007-11-14
7
2,111 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 174
Activex loadlibrary and show parented form issue 6 286
Delphi TcxGrid group footer summary 3 210
Delphi 2 49
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…
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 give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

16 Experts available now in Live!

Get 1:1 Help Now