I'm developing a mobile application that uses a barcode scanner (Motorola MC75A). I installed EMDK for .NET v2.5.
I use the libraries Symbol.dll and Symbol.barcode2.dll for use of the barcode scanner. But I get errors when I run the code on the emulator device with Windows Mobile 6.5.
Code:
Barcode2 myBarcode2 = null;
Device MyDevice = SelectDevice.Select(
"Barcode",Symbol.Barcode2.Devices.SupportedDevices);// Exception here
Exception:
{"Can't find PInvoke DLL 'SCNAPI32.dll'."}
do I need another emulator or something else?
Thanks
AFAIK, SCNAPI32.dll is a native dll, which is present on motorola devices (loaded from ROM) and called by the Symbol dll's. The emulator is not a motorola device so it does not have these libraries installed. If the device has an USB cable you could hook it up using ActiveSync (or windows mobility center) and debug on the device itself; I don't know if motorola has any emulators.
If you really need to test the application using the default emulator, you could create an empty Symbol.dll and Symbol.barcode2.dll, recreate the same interface as Symbol's and debug using those. Instead of activating a scanner you could then Console.WriteLine("Scanner activated");
etc.
I ran into a similar problem with Symbol & Symbol.Audio. My error message was
Can't find PInvoke DLL 'AudioAPI32.dll'
It turns out there are simulated modes for some Symbol "devices". Motorola Symbol libraries detect those modes using registry of the device or emulator. To access the Emulator registry, you can use Visual Studio Remote Tools \ Remote Registry Editor
Then just connect to your emulator (Windows Mobile 6.5.3 Professional Emulator), and make sure there's no Simulation value as 'Never' in
[HKEY_LOCAL_MACHINE\Software\Symbol]
If there is no Simulation-string value, the default is probably Auto - in which case the emulator asks which mode you want to use. You can also try adding Simulation as 'Always'.
You could also add checks to see if devices are available, for example:
if (Symbol.Barcode.Device.AvailableDevices == null) return;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With