Go through the following articles

Interprocess communication through Named pipes
Multithreading in COM