I came across this article on MSDN this morning about using P/Invoke in managed code. Had I came across this article a few weeks back it likely would have saved me some time!

http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dv_vstechart/html/pinvoke.asp