Solved

Cannot hide App button on Taskbar with Delphi 2007

Posted on 2007-11-14
7
2,131 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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