Hello all!
Need a suggestion please.
After I get a process, how can I determine if it's main window / module is hidden or not please?
Because there are hidden window-modules running in the background which are system processes. I wanna get windows of apps that the user has opened manually (by clicking on their shortcuts etc). So I need to skip all system bg apps which their windows are hidden, to get to the manually open ones.
procs = Process.GetProcesses();foreach(Process proc in procs)
{// proc.??
}
I tried checking MainWindowHandle's validity, but as the screengrab show, in the list i get, the only apps that i've manually executed are Visual Studio and few others. The ones like "Datacard Monitor", "MS text input application" are obviously system processes.


Thanks!

Sam HobbsPosted Oct 2, 2022, 10:59 AM
Perhaps you can use p/Invoke to call the IsWindowVisible function. The window handle is in Process.MainWindowHandle.
Or maybe the following will help.
How to get only visible windows with enumwindows - CodeProject
https://www.codeproject.com/Questions/5303477/How-to-get-only-visible-windows-with-enumwindows
Kasun LeePosted Sep 29, 2022, 7:11 AM
@Sam Hobbs Thanks for the input.
Sorry, forget about the module thing, it's just "A Window".
--
The code. I'm not really searching for empty window titles, but rather windows that are Hidden (not minimized, but the visibility is set to false). I did this in C++ a long time ago (VS6 days), but can't figure it out in C#.
Sam HobbsPosted Sep 29, 2022, 6:17 AM
I was going to reply to your previous post but then you deleted it.
I do not know what main window / module means. You still have not clarified that (that part is the same as the previous post). I understand what a main window is but I do not know what the slash "/" means. Does it mean or? I am not sure what it means for a module to be hidden.
The following is the code I was going to post for you. Does that work better? The important part is string.IsNullOrEmpty.