Apparently my probelms were

1. I did not include the line
Imports System.Runtime.InteropServices

2. I was creating an instance of my class when what I actually needed was a reference to it instead.

Seems to be working fine now.

This is a big help for me as I write apps for handheld devices with barcode scanners and now can detect when they are being emulated so as to bypass the code which sets up the barcode scanner engine which would crash on the emulator. Now I shoudl be able to run on both the device and the emulator with no code changes.