.
Download
demo project2 - 30 Kb¡¡
.
Introduction
This article explains how to add
virtual instrument controls to your MFC application from a VI
Array. All virtual instrument controls are included in the VI
Array and only one DLL is needed.
.
Using
VI Array
Steps for
adding virtual instrument controls to your application:
API
Functions
Following
are the API functions in the VI Array. Which can be used to add a control,
to set/get the value of a virtual instument control.
extern "C" long PASCAL EXPORT addGlassBoard(long hl);
Function: New a transparent VI Array to your program.
hl: HWND of the window that add the VI Array and add VI Controls.
.
extern "C" long PASCAL EXPORT delGWVI();
Function: Delete the VI Array.
.
extern "C" long PASCAL EXPORT addIC2Container(char *ICName,long id,char *p1,char *p2,char *p3,char *p4,char *p5,char *p6,char *p7,char *p8);
Function: Add a VI control to the window
ICName: Control name. For example, a Button VI's name is "Button"
id: ID or resource number of the VI. To avoid conflicting with MFC ID, it should be >6000.
*p1,*p2,*p3,*p4,*p5,*p6,*p7,*p8: Initializtion Parameters of the control.
View virtual instrument controls instruction for detail.
.¡¡
extern "C" void PASCAL EXPORT delVI(long id);
Function: Delete a VI control from the window.
id: ID or resource number of the VI.
.
extern "C" double PASCAL EXPORT getICValue(int id,int m);
Function: Get the value of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
Return: double
.¡¡
extern "C" void PASCAL EXPORT setICValue(int id,int m,double v);
Function: Set the value of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
v: Value to set
.
extern "C" char* PASCAL EXPORT getICString(int id,int m);
Function: Get the value of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
Return: String
¡¡
extern "C" void PASCAL EXPORT setICString(int id,int m,char *v);
Function: Set the contect of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
v: String to set
.
extern "C" int PASCAL EXPORT getICArraySize(int id,int m);
Function: Get the length of the array of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
Return: int
.
extern "C" double PASCAL EXPORT getICArrayX0(int id,int m);
Function: Get the start position of the array of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
Return: double
.¡¡
extern "C" double PASCAL EXPORT getICArrayDT(int id,int m);
Function: Get the data interval of the array of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
Return: double
.
extern "C" int PASCAL EXPORT getICArray(int id,int m,int len,double *data);
Function: Get the array of the VI
id: ID or resource number of the VI.
m: Pipe Number of the VI
len: Data length to read
Return: Array
.
extern "C" int PASCAL EXPORT setICArray(int id,int m,int len,double *data,double dt,double x0);
Function: Set an array to the VI.
id: ID or resource number of the VI.
m: Pipe Number of the VI
len: Data length to read
*data: Array to set
dt: data interval of the array
x0£ºthe start position of the array
.
extern "C" int PASCAL EXPORT setICMatrix(int id,int m,int x,int y,double **data,double dt);
Function: Set a matrix to the VI.
id: ID or resource number of the VI.
m: Pipe Number of the VI
x,y: Col and Row of the matrix
data: Matrix
dt: data interval of the matrix, for graph set 1.
.
extern "C" int PASCAL EXPORT getICMatrix(int id,int m,int x,int y,double **data);
Function: Get a matrix to the VI.
id: ID or resource number of the VI.
m: Pipe Number of the VI
x,y: Col and Row of the matrix
data: Matrix