This task is easy if your application Spawned/Shelled the other application with the CreateProcess API function.
If your application did NOT launch the other executable, then You need to get a Handle to the other program's main window. (This is where the WindProc resides).
Once you have this handle, you can basically make the other application do anything you want (by sending windows messages).
A few API calls to look into when doing this:
EnumWindows
GetWindowText
PostQuitMessage
If this doesn't help, there's probably another way ... there always is.