Hi, I think posting a query twice wont serve your purpose as well and as much as being more clear would. Like what do mean by "....write PInvoke by using "OutputDebugString"..". Do you mean you want to USE OutputDebugString in your C# programm using PInvoke.
Secondly, if also mention as to WHY WOULD YOU want to do the things that you are doing, that helps others understand the query better and may be you even get a suggestion on performing the task in some more convinient way.
For this query though, PInvoke is not a hard to pull off trick, but it certainly is tricky. You will find good examples in the documentation for it. What you need to find out is whether you CAN call a function defined in Kernel32.lib and if you can will it work for the debugger associated with C# .NET app.