CreateProcess has a PROCESS_INFORMATION structure as the last parameter. You can use the dwThreadId member of this structure and the WM_QUIT message to close a window using the PostThreadMessage API.
::PostThreadMessage(pi.dwThreadId, WM_QUIT, 0, 0);
«_Superman_» I love work. It gives me something to do between weekends.