Hi!

 

I’m doing a test for the explorer.exe. The first part tests if the explorer Windows open.

For that I´m using the function CreateProcessA(), the problem is that I can’t close the explorer that I have created.

 

This is what I have try and it haven’t worked. Any idea of how could I do it?

 

testExplorer = CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

              if (testExplorer != NULL) {

 

                            /*WaitForSingleObject(testExplorer, 3000); */

 

                            /*

                            CloseHandle(testExplorer);

                            */

 

                            /*

                            CloseHandle(pi.hThread);

                            CloseHandle(pi.hProcess);

                            */

 

                            /*

                            GetExitCodeProcess(testExplorer,lpExitCode);

                            ExitProcess(lpExitCode);

                            */

 

                            /*

                            GetExitCodeThread(testExplorer,lpExitCode);

                            TerminateProcess(testExplorer,lpExitCode);

                            */

                           

                            trace("\n \n Error: %u \n \n", GetLastError());

 

                            return TRUE;

              }