How can I have a program detect that it is already running and if it is it needs to send a string of data to the already running copy and close itself.

Dont know how to do either of these any pointers in the right direction would help

Thanks