C++ devquery sample application – BNC 645 User Manual

Page 188

Advertising
background image

188

' Insert data into text box

txtData.Text = ""

For i = 0 To UBound(readings)

txtData.SelText = readings(i) & " Vdc" & vbCrLf

Next i

Exit Sub

ReadDataError:

Debug.Print "ReadData Error = "; Err.Description

End Sub

Private Sub Form_Terminate()

On Error Resume Next

Set Model 645 = Nothing

End Sub

C++ DEVQUERY Sample Application


This C sample application is a Win32 console application. It illustrates
how to use the BERKELEY NUCLEONICS CORPORATION IOUtils COM. A
Win32 console application is a Win32 application which uses text-based
input and output, not a graphical interface. This allows you to quickly
create a Win32 application by using simple input and output functions.

Creating the Application
Create a new Visual C++ project as follows:
1. Create a new Win32 Console Application project, calling the project

DEVQUERY.

2. Specify that this project will be a simple application in the last

AppWizard step.


LISTING D.4.

THE DEVQUERY FUNCTION.

// DEVQUERY.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

//Purpose: To illustrate the use of the automation layer in a C++ program

//without the use of smart COM pointers. (In general I would advise using smart

//pointers but this example will allow the use of the automation layer without them.

//Note that this is a C++ program and not C, that is we use class structures, however

//it is 'bare bones' in the sense we use COM calls directly and no smart pointers)

//

Advertising