Solved

Taskbar button problem

Posted on 1998-09-16
10
397 Views
Last Modified: 2010-04-06
 I want to make an application which has no button on taskbar (but has an icon in the Taskbar Notification Area). In the project file I made the application invisible (Application.ShowMainForm:=false), so at start I don’t have button on the taskbar. But when I show a form, the application’s button appears on the taskbar.
  I tried two things:
  1. Hiding the button with ShowWindow(Application.Handle, sw_Hide) in OnShow event handler --> the button appears for a moment.
  2. Using the ShowWindow(Form.Handle, sw_Restore) function instead of Form.Show method --> no button appears on the taskbar, but no components appear on the form. Showing each component on form is hard and -- especially -- very ugly.
0
Comment
Question by:zoltan082098
[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
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1339917
zoltan,

you'll have to write a service application. Load Delphi help. Go to index. Look under service. Sorry, have no sources...

Regards, Madshi.
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1339918
Here is something you can do...

procedure TForm1.FormCreate(Sender: TObject);
begin
      SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
   SetWindowLong(Application.Handle, GWL_EXSTYLE, not WS_EX_TOOLWINDOW);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Show;
  Timer1.Enabled := false;
end;

The timer's interval is set to 10000//10 secs
0
 

Author Comment

by:zoltan082098
ID: 1339919
 Viktornet,

  I don’t really understand what your code should do, but for sure not what I need. Fortunately the key idea -- using the WS_EX_ToolWindow style -- works, so I consider your answer acceptable.
  The solution is the following: in the project file I set the application’s window style as a tool window:

program ...

uses ..., Windows, ...

begin
  ...
  SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
  Application.Run;
end;

  Using this solution, I don’t have to do nothing in the forms’ OnShow handler, and by no means need a timer -- no button will appear on the task bar even just for a moment.

Regards,
Zoltan
0
Technology Partners: 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!

 

Author Comment

by:zoltan082098
ID: 1339920
To Madshi: thanks for the tip, but there were nothing about my problem -- I think becouse you have Delphi 4 and I have Delphi 3.

Regards,
Zoltan
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339921
I know what you mean, and the code I gave you has nothing to do with what you want....I just wanted to show you the idea and an example on how to hide the taskbar button from the taskbar, and then show it back..That was the idea...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339922
I'm just wondering why did you give me a D grade. If you didn't like it better don't accept my answer than giving me a D... I'm not for the 50 points....but I need to have somewhat good grades,,,,
//Vik
0
 

Author Comment

by:zoltan082098
ID: 1339923
Because when I read your answer, and I saw the timer and the OnShow event handler, I didn’t even want to try it. But I tried it and I saw what I expected -- your code doesn’t work. I wrote an answer why I reject it, but before pushing the submit button, I tried the WS_EX_ToolWindow style for the application window, in the project file.
I didn’t know that the grade is more important for you than the 50 points. I think that even a B answer must work without modifications (because it’s a GOOD answer), and a C answer must be close to the problem. When the answer doesn’t have even a single good line, and I have to think about how can I use this answer -- this is, for me, barely acceptable.
But no problem, if you want, I will give you A for each answer which seems to be acceptable.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339924
As I mentioned b4 this was just an example.... I needed to refresh the app so I needed to use the timer for that.....
-------
This procedure below hides the taskbar button of your app...
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
This next procedure makes it so the app button has to show up but for that to work I needed to update the form and I didn't wanted to take so much time to write the example... That's why I used the timer....and then disable it...

About the points I expect to have good grades, which is more important to me!

Regards,
Viktor Ivanov

SetWindowLong(Application.Handle, GWL_EXSTYLE,  not WS_EX_TOOLWINDOW);
0
 

Expert Comment

by:adrenalindx
ID: 8736541
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowWindow( Application.Handle, SW_HIDE );
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);

 //ShowWindow( Application.Handle, SW_SHOW );
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ShowWindow( Application.Handle, SW_SHOW );
SetWindowLong(Application.Handle, GWL_EXSTYLE,  not WS_EX_TOOLWINDOW);

end;


iv got this 2 work but i cant get it to work by jus hidin one window, i hav to hide the whole app, even tried using handle insted of application.handle;
0
 

Expert Comment

by:adrenalindx
ID: 8736578
oopssorry rong question lol
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

717 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