简体   繁体   中英

How to determine if a process has GUI or not?

How to determine if a process has responsive GUI or rather it's a background application? May be there are some API function calls that are necessarily made?

(The answer doesn't necessarily has to involve API calls)

The closest Windows API call to deduce this information would be GetGUIThreadInfo . Note the following paragraph from the Remarks section:

If the specified thread does not exist or have an input queue , the function will fail.

A thread with an input queue can potentially own windows. Note that a thread with an input queue is not required to create windows. Note also, that a non-GUI-thread can be propagated to a GUI-thread at any point.


Note: Even though executable images specify the subsystem , under which they run (eg CONSOLE or WINDOWS ), this cannot be used to distinguish between a process with a GUI and a 'background process'. A process running in the CONSOLE subsystem can create a GUI just as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM