VB6 Examples for the LabJack U12
support@labjack.com

Mar 26, 2007

Includes 1 example showing direct DLL calls, and 4 examples
showing ActiveX calls.  ActiveX (OCX) is the recommended method
and will be discussed here.  The main problem with the direct DLL
calls involves passing large arrays, and thus stream and burst
functions are particularly difficult if not impossible.  All
functionality is supported, however, through the ActiveX wrapper.

To call the U12 functions, you must add the U12 OCX to the front
panel of your project, where it appears as an ellipse.  Or, if an
example project already has the ellipse, but does not seem
to recognize the U12 functions, you might need to re-add to delete
the ellipse and re-add the OCX to your project.

The LabJack U12 OCX is a non-visual ActiveX component.  It only
has methods (functions), and does not have properties, events, or
a graphical representation.  When the OCX is added to your front
panel, it appears as an ellipse.

Here is how you add the U12 OCX component to a project:

1)	In VB6, Go to "Project => Components" or press "Ctrl-T" to bring
	up the components window.

2)	Scroll down to the control called "ljackuwx ActiveX Control module",
	check-it, and press OK.

3)	On the toolbar on the left of your VB screen you will now see a little
	purple "OCX" symbol. Click on this, and then click-and-drag on your
	front panel to make an ellipse. If you look at its properties, VB seems
	to give it the default name Ljackuwx1.
	
4)	Now if you go to the code form of your project and type "Ljackuwx1.", as
	soon as you type the period ("."), VB6 should recognize the component
	name and pop up a list of available functions.  After you pick a
	function name and type "(", VB6 will list the parameters.
	

The U12 functions are defined in Section 4 of the U12 User's
Guide.  The functions are often the same (except for an "X" added
to the end of the name), whether using direct DLL calls or OCX
calls, and any differences are pointed out in the documentation
for each function.

The LabJack forum is a good resource for more help with VB or
U12 function calls in general:

http://www.labjack.com/forums/index.php?


We have found a couple tips that seem to be useful in VB6:

1)  Always put "Option Explicit" in your program.

2)  In function calls, always uses variables (not constants) for
	parameters that are defined as pointers in the DLL.  For
	instance, in the function EAnalogIn from Section 4.1 of the
	U12 User's Guide, the idnum parameter is shown with an
	asterisk ("*"), which means it is a pointer.  So rather than
	just passing a "-1" in the function call, we pass a variable
	"lngIDNum" that is set to -1.
