Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use basically nethod showwindow(hwnd,0) to hide all visible windows,but however,some windows in spy++ such as tskmgr and regedit still in appearance.Is there some method else i should try?For example,Once i run the code below,window spy++ still insists on screen.

What I have tried:

C#
EnumWindows((hw, lPara) =>
{
    if (IsWindowVisible(hw) == true)
    {
        ShowWindow(hw, 0);
    }
    return true;
}, IntPtr.Zero);
Posted
Updated 4-Jan-24 21:53pm
v2
Comments
PIEBALDconsult 5-Jan-24 9:51am    
Is that what your users want?
Qing Lucking 5-Jan-24 10:31am    
Pardon,no user but i,Ijust wanna implement that case that all visible windows go disappeared shows no icons, bars except the wallpaper on screen.BUT some inner windows can't hide by func showwindow(hw,0)
PIEBALDconsult 5-Jan-24 10:32am    
Maybe you want to run in kiosk mode?
Qing Lucking 5-Jan-24 10:36am    
No none,no such a difficulty.just C# to make windows dies out and show wallpaper alone
[no name] 5-Jan-24 15:18pm    
https://stackoverflow.com/questions/33781788/how-to-get-hidden-windows-handle-of-the-windows-that-show-hidden-system-tray-ico

See the note below the Remarks section at EnumWindows function (winuser.h) - Win32 apps | Microsoft Learn[^].
 
Share this answer
 
Comments
Qing Lucking 5-Jan-24 7:47am    
very funny
Richard MacCutchan 5-Jan-24 8:21am    
It was a serious point. But perhaps you did not bother reading it.
Qing Lucking 5-Jan-24 10:11am    
Whatever,thanks for help.But I had read that func parameters meaning over several times.Perhaps it provide no solution for what i asked.Some windows inner couldn't receive the Showwindow commands to show them hidden
Richard MacCutchan 5-Jan-24 10:34am    
It's quite possible that some Windows do not respond to such requests as thay are effectively system processes.
Qing Lucking 5-Jan-24 10:41am    
That was troublesome.I don't know how windows paint and refresh and why some system process windows really stabbon on screen
In additional to previous solution and notes of EnumWindows I want to point that if you running code as particular user and the application which is owning window you want to hide as admin then the function ShowWindow will fail.
Also from the user perspective hiding windows of the application which is not started from your process or not related to your application is very bad design. If you doing that with your own applications then it is better to use RegisterWindowMessage and any of message sending functions such as BroadcastSystemMessage, SendMessageCallback or similar. It is also possible to use named notification events as the hiding signal.

Regards,
Maxim.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900