Kasun Lee

Kasun Lee

  • 1.4k
  • 178
  • 12.9k

How can I determine if a main window / module is hidden?

Sep 29 2022 5:23 AM

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!


Answers (3)