Link to home
Start Free TrialLog in
Avatar of hjohari
hjohari

asked on

How to hide other window program

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
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

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
Avatar of inthe
inthe

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 :-)
ASKER CERTIFIED SOLUTION
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Russell Libby
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