LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Visual Studio 2008 with Labview command, Use of PlotWaveform commando

Solved!
Go to solution

Hi

I want to use the following Labview/CVI commando: PlotWaveform in Visual Studio 2008.

But I get a -10 return error when I try to use PlotWaveform.

 

I use the following code:

#include "stdafx.h"
#include <stdio.h>
#include <winsock2.h>
#include <stdlib.h>
#include <utility.h>
#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
if (InitCVIRTE (0, 0,0)==0)
return -1; //Out of memory

int panelHandle = NewPanel(parentPanel,"Graph",top,left,height,with);
printf("panelHandle: %d\n",panelHandle);

int nNewCtrl = NewCtrl(panelHandle,CTRL_NUMERIC,0,10,10);
printf("nNewCtrl: %d\n",nNewCtrl);

DisplayPanel (panelHandle);

int PlotWaveform_RETURN_VALUE = PlotWaveform (panelHandle, nNewCtrl, myArray,4,VAL_DOUBLE,1.0,0.0,0.0,1.0,VAL_FAT_LINE,VAL_DOTTED_SOLID_SQUARE,VAL_SOLID,1,VAL_RED);
printf("PlotWaveform_RETURN_VALUE: %d\n",PlotWaveform_RETURN_VALUE);

RefreshGraph (panelHandle, nNewCtrl);

The result when I run the program is the following:
panelHandle: 1
nNewCtrl: 2
PlotWaveform_RETURN_VALUE: -10

I do get a graph frame but no graph. And the frame that shows is not running correct.

What is the problem with the PlotWaveform function, what does the -10 error indicate?

BR
Benjamin

0 Kudos
Message 1 of 4
(3,153 Views)
Solution
Accepted by topic author bandersen

Benjamin,

 

That error means that you're passing a control of the wrong type to the function in question. And that is because you are creating a control of type CTRL_NUMERIC instead of CTRL_GRAPH or  CTRL_GRAPH_LS.

 

Luis

0 Kudos
Message 2 of 4
(3,147 Views)

Hi

 

Great it worked 🙂

 

But the window that appears  with the graph is freezing, do you need some more commands to make it into a window that you can move around?

 

BR

Benjamin

0 Kudos
Message 3 of 4
(3,140 Views)

Hi

 

I have solved the problem.

0 Kudos
Message 4 of 4
(3,126 Views)