?
Solved

How to hide other window program

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

765 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