How do I use the Ranger ActiveX control in my .NET environment?

How do I use the Ranger ActiveX control in my .NET environment?

There are two approaches to incorporate an ActiveX control into a Dot Net environment.

The first approach involves adding the control into a form:

Under [tools], please select "Add/Remove Toolbox Items..." or "Choose Toolbox Items..." to view the list of COM components in order to add the active X control to the tool box.  On the form view, drag the active X control from the toolbox that was added previously.  By doing so, both the Ax[OCX name]Lib and [OCX name]Lib references will be created.

Furthermore, the location of the resources, Interop.[OCX name]Lib.DLL and Ax[OCX name]Lib.DLL, should be under either the release or debug folders, depending on the configuration you are running.  These files will be generated into the appropriate folder once you switch the build configuration if the file is not found as long as the OCX is registered.  Once the interop references have been added, all methods and events will become available to the application.  If the OCX is not available, please register the control as follows:
  1. Select [Start Menu]
  2. Select [Run]
  3. Type [regsvr32 "[drive]:\[full path]\[OCX name].ocx"] and press [enter]
  4. You'll see a message indicating that the registration succeeded.

The second approach is to create the interop files, mentioned above, manually and add them to the project without the use of forms:

Both the Ax[OCX name]Lib and [OCX name]Lib references must be created manually by using Aximp.exe; Aximp.exe is found in the Visual Studio folder:
      aximp /out:[Full path to store interop files]\Ax[OCX name]Lib.dll  [full path to OCX]\[file name].ocx

1. Add the [activeXControl name]Lib.dll and Ax[activeXControl name]Lib.dll files to the project as follows:
  1. Select 'Project'.
  2. Select 'Add Reference'.
  3. Under the '.Net' tab, select 'System.Windows.Forms.dll' if not added by default.
  4. Browse to the folder containing the interop DLL files created previously and add them to the project as well.

2. Create an object of type [activeXControl name] in the application as follows:
VB. Net:
  1. Dim OCXVar As New Ax[activeXControl]Lib.Ax[OCX name]
  2. OCXVar.CreateControl()

C#:
  1. Ax[activeXControl]Lib.[OCX name] OCXVar = new Ax[activeXControl]Lib.Ax[OCX name]();
  2. OCXVar.CreateControl();
Please note that the call to CreateControl is imperative in order to initialize the control before usage.

Copyright © 2023 Silver Bullet Technology
www.sbullet.com


    • Related Articles

    • How do I use Ranger in a C# or VB.NET web application?

      How do I use Ranger in a C# or VB.NET web application? Ranger cannot be added to a .NET web application in the same way as the sample apps. This is because the C# or VB.NET code is run on the server, and the Ranger ActiveX control must be run ...
    • How do I register a Ranger ActiveX control?

      The steps below should be used when registering a Ranger ActiveX control manually: Select [Start Menu]. Select [Run]. Type 'regsvr32 [Drive]:\[Full path to Ranger.ocx]\Ranger.ocx'. Press 'OK'. Ranger® - The universal check scanner interface Copyright ...
    • How do I use Ranger with Java?

      Using Ranger with Java (not Javascript) There is a Java interface, JNI, for Ranger called JRanger. It can be found on our website after logging in and selecting the "Ranger SDK" link. Because Ranger and the drivers that Ranger uses are 32 bit you ...
    • Can I use Ranger in my web-based application?

      Yes. Many Ranger users have web-based applications. Some application developers use our JavaScript library. Others use a Ranger browser plug-in, DLL or ActiveX control. Ranger® - The universal check scanner interface Copyright © 2023 Silver Bullet ...
    • Must I use Image File Sets to store images captured using Ranger?

      You do not need to save images into Image File Sets unless you need Ranger compatibility with large Unisys check scanner/sorters. You can access the images in the Ranger "InPocket" event via the GetImageAddress() and GetImageByteCount() functions. If ...