Solved

How to hide other window program

Posted on 2001-07-02
5
213 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

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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