Windows Programming - How to find whether a PID will open a visible Window

checkingrandom 226 Reputation points
2022-05-02T08:27:14.593+00:00

I am working on a project, when a new process is created I'll get notification.

as a result I'll receive the Process ID and Process name of the newly created process.

So, Is there any way to predict that a particular PID will create a Visible window

To make it more clear, Take this example:

  1. Firstly, when a process starts, I get the process name and process ID.
  2. If the process is user Invoked a Visible window will open and if it a System process it will work on the background.

Now let we see between step 1 and step 2, we get a process ID, with the help of this process ID can we predict that this process will create a user interactive window or not...??

Note:

  1. It is to be noted that the process is not yet started fully, so no visible window is created. so we cannot use Enumwindows to differentiate
  2. Say for example we debug line by line, so when a process starts we get the process ID, we debug to the next line, The process is not started fully. At this line can we programmatically find that this process will create a visible window or not.

I hope you understand my question, If not please State your query in the comments. I'll try it explain to the max

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,690 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,788 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 86,316 Reputation points
    2022-05-02T08:36:35.39+00:00

    can we predict that this process will create a user interactive window or not...??

    You cannot "predict"...
    But, as I said in another thread, you can intercept/block/modify/... any window creation with a WH_CBT Hook (DLL)
    (or SetWinEventHook to be notified)

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.