The site I got that code from said that you would have to use a message hook to let the .net program know about a callback and the key that was pressed. But maybe that was not for .net but for unmanaged programs.