Solved

Showing a form without displaying it in taskbar

Posted on 1998-09-11
4
190 Views
Last Modified: 2010-05-18
How could I show a form without displaying it in taskbar?
This form is the MainForm of my program, so setting border style to bsDialog doesn't help.
0
Comment
Question by:bvrab
[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
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
duke_n earned 100 total points
ID: 1339380
There was exactly this question before(answered by Ronit). here is the answer.
to hide it from taskbar call the HideTaskClick procedure.to show again call the ShowTaskClick procedure:


procedure TForm1.HideTaskClick(Sender: TObject);
var wndHandle : THandle;
     wndClass : array[0..50] of Char;
begin
     StrPCopy(@wndClass[0], 'Shell_TrayWnd');
     wndHandle := FindWindow(@wndClass[0], nil);
     ShowWindow(wndHandle, SW_HIDE); // This hides the taskbar
end;

procedure TForm1.ShowTaskClick(Sender: TObject);
var wndHandle : THandle;
     wndClass : array[0..50] of Char;
begin
     StrPCopy(@wndClass[0], 'Shell_TrayWnd');
     wndHandle := FindWindow(@wndClass[0], nil);
     ShowWindow(wndHandle, SW_RESTORE); // This restores the taskbar
end;


0
 
LVL 1

Expert Comment

by:duke_n
ID: 1339381
No,man, sorry, this was to hide the taskbar!!!!! here how to hide FROM taskbar(put that in your PROJECT SOURCE):
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Windows; //THIS IS REQUIRED TO SET THE WINDOW STYLE!

{$R *.RES}

//Declare a var to retrieve current window information
var
  ExtendedStyle : Integer;

begin
  Application.Initialize;

  //Get the Extended Styles of the Application, by passing its
  //handle to GetWindowLong
  ExtendedStyle := GetWindowLong(Application.Handle,
GWL_EXSTYLE);
  //Now, set the Extended Style by doing a bit masking operation.
  //OR in the WS_EX_TOOLWINDOW bit, and AND out the      
  //WS_EXAPPWINDOW bit  
  //This effectively converts the application from an App
  //Windows to a Tool Window.
  SetWindowLong(Application.Handle, GWL_EXSTYLE, ExtendedStyle OR WS_EX_TOOLWINDOW AND NOT WS_EX_APPWINDOW);
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339382
Here is something that I hope won't confuse you that much....

In your form's OnCreate() add this code....

SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);

Regards,
Viktor Ivanov
0
 

Author Comment

by:bvrab
ID: 1339383
Thank you for your answer (comment). I actually needed the code for C++ Builder and with slight changes this code works there as well.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 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