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; }
On 19/03/18 05:25, Carlos Vega García wrote:
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.
Hello Carlos,
The problem in this case is that native explorer.exe windows aren't (by default) associated with a specific process. Starting an explorer.exe process instead creates a window in the "main" explorer process.
It's possible to detect and close these windows—either using the IShellWindows interface (which doesn't currently work on Wine) or simply by looking for a window with matching title and class (as in shell32:progman_dde). You would then post a WM_QUIT message to the window. Unfortunately I'm not sure either method is really advisable, since you don't have much control over how long the window will take to appear. The progman_dde tests already fail intermittently on Windows.
ἔρρωσο, Zeb