Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to hide other window program

Posted on 2001-07-02
5
Medium Priority
?
224 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
[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
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 200 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

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

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…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

604 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