Hello again
What I want to do now is to close another opened application, without leaving dlls or other trash in memory. I understand that I have to send a WM_QUIT message to the handler of the other application. What I don't know is how do I get it (the hWnd)? Could you give me some clues? Thanks
2. For each ProcessID, use OpenProcess() to open and get a handle to each process. Use PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE access rights. If the process doesn't open, then you don't have permission to close it, it's probably a system process. http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx
I'm not sure how to do this in a more Win32 gui style with hWnd but I am pretty sure that if a process is terminated, all of the memory that was dedicated to that process is now free.
Thanks to everyone. Stewbond, I will use TerminateProcess, which is a more brutal than SendMessage(WM_CLOSE), only if SendMessage doesn't close the window. Thanks, again!