How OutputDebugString works

Hi,

I am querious about how OutputDebugString works. If I want to write application like DebugView from Sysinternals, how should I proceed about the same ?

Thanks & regards,
Rajesh