Listing d.1 – BNC 1201 - 6 1/2 Digit Digital Multimeter User Manual

Page 165

Advertising
background image

166

Instance, and Unhandled Exception) is not executed. The Startup Object

property can be set in the Application pane of the Project Designer.

To change the startup object

1. With a project selected in Solution Explorer, on the Project menu

click Properties.

2. Select the Application pane.

3. Select a Startup object from the Startup object drop-down list.

To set the startup object for a Windows Application to Sub Main

1. With a project selected in Solution Explorer, on the Project menu

click Properties.

2. Select the Application pane.

3. Check the Startup with custom Sub Main checkbox.

4. Select Sub Main from the Startup object drop-down list.

LISTING D.1. MEASure.bas--THE Sub Main FUNCTION IS WHERE YOU

NEED TO ADD INITIALIZATION CODE.


Sub Main()

Dim stat As ViStatus
Dim dfltRM As ViSession
Dim sesn As ViSession
Dim fList As ViFindList
Dim desc As String * VI_FIND_BUFLEN
Dim nList As Long
Dim ret As Long
Dim readin As String * 64

stat = viOpenDefaultRM(dfltRM)
If (stat < VI_SUCCESS) Then
'Rem Error initializing VISA ... exiting
MsgBox "USBTMC resource not found.", vbExclamation, "1201 multimeter
device test"
Exit Sub
End If

Rem Find all 1201 USBTMC instruments in the system
stat = viFindRsrc(dfltRM, "USB[0-9]*::0x164E::0x0FA3::?*INSTR", fList,
nList, desc)
If (stat < VI_SUCCESS) Then
'Rem Error finding resources ... exiting
MsgBox "1201 device not found.", vbExclamation, "1201 multimeter device
test"
viClose (dfltRM)
Exit Sub
End If

Advertising