I have a situation where I launch several processes from a program using CreateProcess() function.
At one time, I have to access all these processes, one by one and tell them to hide/show (minimize/maximize). Is there a way to do it? I'm looking something like what I use to terminate the processes.
Like this:
Code:
 int numHandlers = this->vProcessInformations.size();
   for (int c=0;c<numHandlers ;c++)
       {
        PROCESS_INFORMATION *pInfo = NULL;      
        pInfo = this->vProcessInformations[c];  
        HANDLE handle = pInfo->hProcess;
        DWORD exitCode = NULL;
        bool bRet = false;
        DWORD lastError;

        bRet = GetExitCodeProcess(handle,&exitCode);
        lastError = GetLastError();
        
        TerminateProcess(handle,(UINT)exitCode);
        CloseHandle(handle);
        
        delete pInfo;
       }
I currently use IPC using mail slots to send command messages to other processes where each process creates mail slot handle unique to it from start parameters so I can access them all.
But this has many flaws in it since I iterate through processes very fast, not all processes get the message sent.

I basically need fast and reliable technique that will iterate through processes (created by myself) and send them commands to execute.

Any recommendations on this topic?
Thanks.