As _D3m0n_ said, there are already DLLs for this, and if I'm not mistaken, it can also be accomplished using COM.