LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling .net assemblies from LabView

Hi Everyone,

I am trying to develop a code for Zebra Scanner in LabView using C# .net dll. I am able to read the scanner parameters such as scanner part#, Serial# and other information. I am trying to read the barcode using the callback event. I didn't try it before. Could you please help me to develop the application so I can read the barcode? 

Please find the enclosed folder with Labview project and c# code in pdf.

Thanks.

Gurjit

Download All
0 Kudos
Message 1 of 9
(2,155 Views)

When a Zebra scanner scans a barcode, it tells the connected computer what it scanned with simulated key presses. You should be able to drop a while loop and event structure and listen for those key presses. At least on our Zebra scanners you can.

 

Edit: also, your "Untitled 2.vi" callback VI is not included in your zip so couldn't run it anyway.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 2 of 9
(2,148 Views)

Hi FireFist,

 

Please find the enclosed zip file again.

Could you please let me know which vi should be kept in the while loop with event structure and is there any way that code should ask for scanning a barcode?

 

Regards.

Gurjit

0 Kudos
Message 3 of 9
(2,121 Views)

@FireFist-Redhawk wrote:

When a Zebra scanner scans a barcode, it tells the connected computer what it scanned with simulated key presses. You should be able to drop a while loop and event structure and listen for those key presses. At least on our Zebra scanners you can.

 

Edit: also, your "Untitled 2.vi" callback VI is not included in your zip so couldn't run it anyway.


Only if you are using it in keyboard emulation mode. I generally do prefer SNAPI.

 

 


@Matharoo wrote:

Hi FireFist,

 

Please find the enclosed zip file again.

Could you please let me know which vi should be kept in the while loop with event structure and is there any way that code should ask for scanning a barcode?

 

Regards.

Gurjit


add_BarcodeEvent() is generating the error. The constant you are giving it as a parameter is invalid, and you aren't going to be able to build a the eventhandler object in LabVIEW.

 

That said, I remember determining that using Interop.CoreScanner.dll directly wasn't possible. I don't recall the exact details, but IIRC it had to do with some .Net feature(s) not supported by LabVIEW.

 

If you have the Zebra SDK installed then it should come with a Visual Studio template that contains CSProxy.dll, which is a more user friendly wrapper around the interop library that I have had good success integrating with LabVIEW.

 

(Note: IIRC, newer versions of Visual Studio do not support the VSI format for installing templates, but the file format is just a ZIP file. You can get at the template using 7-Zip or other archive utilities.)

0 Kudos
Message 4 of 9
(2,104 Views)

Hi,

I have Zebra SDK installed it has "SDK- Visual Studio Project Template".  but when I opened it with Visual studio it has machine codes. Could you please let me know how to get CSProxy.dll.

 

Regards.

Gurjit

0 Kudos
Message 5 of 9
(2,054 Views)

I think what you mean is that you are just seeing binary data? As I said previously, current versions of Visual Studio no longer support installing things that way, so don't try to open the .vsi file in Visual Studio. (I don't know why Zebra continues to distribute it in that form.)

 

You need to go the location where the template file is installed, which is Program Files\Zebra Technologies\Barcode Scanners\Scanner SDK\Scanner SDK\Visual Studio Integration by default.

 

Either open that file directly with a program like 7-zip or rename it to .zip and you should be able to see the content. The "template", which is actually more like another sample application, is located at:

 

Zebra Scanner SDK Project Template Installer.vsi\Zebra Scanner SDK Project Template.zip\ScannerSDKApplication\

 

CSProxy.png

 

I don't have a copy of the VIs handy to share, but I was able to integrate that library without too much difficulty. (Including using callbacks to handle scan events.)

Message 6 of 9
(2,023 Views)

Hi

 

Thanks a lot for providing the exact location of csproxy.dll. I saved the folders. When I tried to run the programs, I see an error 1172. Please check the enclosed pic. when I tried another class ScannerAttributes, It work fines but I didn't receive any error. I also tried Scanner events class and tried to read the barcode. I didn't receive any errors and also didn't receive any barcodes.

Please find the enclosed screenshots of three codes. What is wrong with the code?

 

Regards.

Gurjit

Download All
0 Kudos
Message 7 of 9
(1,972 Views)

As error 1172 indicates, it cannot locate Interop.CoreScanner.

 

CSProxy is a wrapper around the interop library. You need to include both DLLs in the same folder.

 

ScannerEvents is just an Enum. All you were doing in Barcode.jpg was writing the BARCODE value to an indicator inside a value change structure.

0 Kudos
Message 8 of 9
(1,922 Views)

Hi JimB,

 

By putting CSProxy and interop CoreScanner dll in same folder still, I am getting 1172 error. 

Also by adding indicator to newVal of Data Val change event, no output was received. I found that event doesn't read any data. It got stuck.

Could you please share your barcode read code, if you tried it?

I appreciate your feedback. Thanks

0 Kudos
Message 9 of 9
(1,892 Views)