Solved

How to hide other window program

Posted on 2001-07-02
5
212 Views
Last Modified: 2010-04-06
How to hide or deactivate other running Window programs ?
When I run my application, I want to hide/deactivate all applications which active at that time.
So the only running application is my application.

Thanks,
Hendra
0
Comment
Question by:hjohari
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 6244709
Hi hjohari,

Add this code to your OnCreate Event:

procedure tForm1.FormCreate ( Sender:TObject);
var
  h:HWnd;
begin
  h:=handle;
  while h > 0 do
  begin
  if isWindowVisible(h) then
    ShowWindow(h,SW_HIDE );
    h:=getnextwindow(h,GW_HWNDNEXT);
  end;
  ShowWindow(handle,SW_HIDE );
end;

// dont forgent to show the windows again ;-)

Best Regards

Cesario
0
 
LVL 17

Expert Comment

by:inthe
ID: 6244760
hi,

>>dont forgent to show the windows again ..

with even the taskbar being hidden here you'd have to save those handles somewhere (maybe ini file?) as theres no WasWindowVisibleBefore_I_Hid_It() api to know what was not hidden before :-)
0
 
LVL 8

Accepted Solution

by:
Cesario earned 50 total points
ID: 6244816
I argree with inthe,

you can use a Open Array to store the handles...

VAR
  hiddenwindows : Array OF TWND;

procedure tForm1.FormCreate ( Sender:TObject);
var
 h:HWnd;
begin
 SetLength ( hiddenwindows,0);
 h:=handle;
 while h > 0 do
 begin
   if isWindowVisible(h) then
     ShowWindow(h,SW_HIDE );
     h:=getnextwindow(h,GW_HWNDNEXT);
    SetLength(hiddenwindows,Length(hiddenwindows)+1);
    hiddenwindows[High(hiddenwindows)] := H;
 end;
 ShowWindow(handle,SW_HIDE );
end;

to show them again

VAR
 cnt : Integer;

begin
  For cnt := 0 To High(hiddenwindows) DO
     ShowWindow(h,SW_SHOW );
  SetLength(hiddenwindows);

Best Regards

Cesario
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8701442
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Cesario's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

18 Experts available now in Live!

Get 1:1 Help Now