Subj : Re: CreateProcess To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Thu Jun 17 2004 04:34 pm User programs are not designed to run forever. They all end. The program you launch with a call to CreateProcess should have internal coding for how it shuts down. If you want to shut it down prematurely you should start by asking yourself why you need to do that and why you are launching that program when you did not want it to do what it is supposed to do. If you absolutely must shut it down, send a WM_CLOSE message to each of its top level windows. TerminateProcess is only for an emergency shutdown of the program and does not clean up by unloading DLL's and freeing all resources. Especially if using an OS from the Windows 95/98/ME tree, failing to unload and free those items can have a bad effect on the operating system. ExitProcess is not normally used in programs. The compiler's startup code provides it. You end your program by executing the return statement in main, OwlMain or WinMain. .. Ed > mike wrote in message > news:40d1eb59@newsgroups.borland.com... > > i was reading the documentation on CreateProcess () and it says the > preferred way to shutdown a process is to use the ExitProcess () rather than > the TerminateProcess (). i don't understand how this works.... > > TerminateProcess - this can take in a process handle and ExitProcess can't > > so when i run my executable, i start a 3rd party executable. how do i > gracefully exit it? if i call ExitProcess () it will close my application > and not the one i started. > > The problem i'm seeing is that eventually when i call CreateProcess it fails > with an error code of 1813: The specified resource type cannot be found in > the image file. ERROR_RESOURCE_TYPE_NOT_FOUND. > > is this because the DLL's are in a compromised state? > > how can i get around this??? .