Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with GetVIReference in vc++

Hai

I have problem with GetVIReference. I getting errors in VC++ 6.0.
"error C2660: 'GetVIReference' : function does not take 3 parameters"
MyCode:

#include "stdafx.h"
#include "windows.h"
#include "stdio.h"
#include "conio.h"
#include
#include
#include
#import "C:\Programme\National Instruments\LabVIEW 7.0\resource\LabVIEW.tlb"

main()
{
VARIANT result1;
VARIANT result2;

int size = 0;
char Path[1000];
char Password[60] = " ";

char VIPath[100] = "C:\\Programme\\National Instruments\\LabVIEW 7.0\\vi.lib\\VB_Local_LabVIEW.VI";
using namespace LabVIEW;
_ApplicationPtr pLV;
VirtualInstrumentPtr pVI;

CoInitialize(NULL);
do
{
pLV.CreateInstance("LabVIEW.A
pplication");
if (pLV == NULL)
{
printf("LV must be running, existing");
break;
}

pVI.CreateInstance("LabVIEW.VirtualInstrument");
strcpy(Path, pLV->ApplicationDirectory);
strcat(Path,VIPath);

pVI = pLV->GetVIReference(Path, Password, 0);//,Password,0);

pVI->SetControlValue("flStarted", "0");
pVI->SetControlValue("strCommand", "FunctionName");
pVI->SetControlValue("strParam1","Parameter1");
pVI->SetControlValue("strParam2","Parameter2");

pVI->Run(0);

result1 = pVI->GetControlValue("String1");
result2 = pVI->GetControlValue("String2");

printf("The Result1 of LabVIEW %f \n", result1.fltVal);
printf("The Result2 of LabVIEW %f \n", result2.fltVal);

while(!kbhit() )
cout<<"Hit any key to Continue \r";
fflush( stdin );

pLV->AutomaticClose = 0;
} while(0);

CoUninitialize();
return 0;
}

Thanks
reddy
0 Kudos
Message 1 of 2
(3,466 Views)
Hai i got the solution, but VI program is executing

pVI = pLV->GetVIReference(LPCTSTR(Path),LPCTSTR(Password),0,0);

i am getting
RunTime Error:
"Abnormal Program Termination"
i think problem with "GetVIReference"
how can solve? i am using LabVIEW 7.0

thanks reddy
0 Kudos
Message 2 of 2
(3,466 Views)