National Instruments PC-OPDIO-16 Manuale Utente

Pagina di 92
Chapter 4
The Fundamentals of Building Applications with NI-DAQ
© National Instruments Corporation
4-11
PC-OPDIO-16 User Manual
Creating a Windows Application Using Microsoft Visual C++
This section assumes that you will be using the Microsoft Visual Workbench to manage your
code development.
For Windows programs in general, remember to follow this procedure:
1. Open a project module to manage your application code.
2. Create files of type 
.cpp
 (C++ source code).
3. Create a module definition file, and add it to the project.
4. Create your resources using the 
App Studio
.  After you have created the resources, save
them into an 
.rc
 file and add the 
.rc
 file to the project.
To use the NI-DAQ functions, you must use the NI-DAQ DLL.  Follow this procedure:
1. Create your source file as you would for other Windows programs written in C++, calling
NI-DAQ functions as typical function calls.
2. Prototype any NI-DAQ routines used in your application.  Include the NI-DAQ header file,
which prototypes all NI-DAQ routines, as shown in the following example:
#include "WDAQ_C.H"
3. Add the NI-DAQ import library 
NIDAQ.LIB
 to the project module.
Special Considerations
See Special Considerations in the Creating a Windows Application Using Borland C++ and the
Windows SDK section earlier in this chapter.
Creating a Windows Application Using Turbo Pascal
For Windows programs in general, remember the following points:
1. Turbo Pascal for Windows 1.0 and 1.5 users:  Create files of type 
.pas
 (Pascal source
code), including the Windows object units 
WObjects
WinTypes
, and 
WinProcs
.
Turbo Pascal 7.0 users:  Create files of type 
.pas 
(Pascal source code), including the units
OWindows
ODialogs
WinTypes
, and 
WinProcs
.
2. Create your resources using the Borland Whitewater Resource Toolkit and save the resources
into a 
.res
 file.  You must add this resource to the executable file by using the 
{$R ...}
compiler command.