Showing results for 
Search instead for 
Did you mean: 

Get tag list from LabView DSC using C++ Active X

I am trying to read the group list from LabViewDSC 6.1 using C++ and Active X.
I started from the Aquire6 example and modify it to load Get Group
The problem I have is that I can read a boolean or a number control, but a string
array control makes the program crash.
I will appreciate any hints on how to read "group list" and "error out" controls.


// Acquire.cpp : This source code is an Automation client. It calls the
// LabVIEW 6.0's automation server. It loads the VI Acquire 1 Point from 1 Channel
// VI and runs it.

#define _WIN32_WINNT (0x0400)
//#define LABVIEW_70

#include "windows.h"
#include "stdio.h"
#include "conio.h"
#ifdef LABVIEW_70
#import "\Program Files\National Instruments\Labview 7.0\RESOURCE\labview.tlb"
#import "\Program Files\National Instruments\Labview 6.1\RESOURCE\labview.tlb"

int main(int argc, char ** argv)
int size = 0;
char Path[1000],Password[60] = "";

// define the path to the application
char VIPath[1000] = "\\vi.lib\\lvdsc\\TagAttr\\User\\Get Group";
// generate a namespace declaration to and identify and assign a name to a declarative region.
// In this case we are assigning the LabVIEW.
using namespace LabVIEW;
_ApplicationPtr pLV;
VirtualInstrumentPtr pVI;


if (pLV == NULL)
printf("LV must be running, exiting ...\n");

// Get Group List
// assign an object reference to the pVI.
strcpy(Path, pLV->ApplicationDirectory);
strcat(Path, VIPath);
#ifdef LABVIEW_70
pVI = pLV->GetVIReference(LPCTSTR(Path), LPCTSTR(Password), 0, 0x10);
pVI = pLV->GetVIReference(LPCTSTR(Path), LPCTSTR(Password), 0);
pVI->FPWinOpen = TRUE;

//Transfer control to LabVIEW with the Run statement. The call function passes the parameter names
// and data to the LabVIEW VI.

VARIANT notLoaded;
VARIANT errorOut;
notLoaded = pVI->GetControlValue("no .scf loaded");
errorOut = pVI->GetControlValue("error out");
list = pVI->GetControlValue("group list");

while( !kbhit() )
cout << "Hit any key to continue\r";
fflush( stdin );
// pVI->CloseFrontPanel();
// pLV->AutomaticClose=0;

} while (0);
return (0);
0 Kudos
Message 1 of 3
Hi Mariana,
I have also to the support email you sent. I assume you got the acquire6.cpp example from .

If you read the response from the NI AE in that post, you will see another solution posted. I would highly recommend his suggestion to use specific datatypes instead of Variants. For example, try using a 2-dimensional character array for the string array control and use a struct for the Error Out cluster. Please try that and see if it works better.

Hope this helps. Please let me know if you have any further questions.

A Saha
Anu Saha
Academic Product Marketing Engineer
National Instruments
0 Kudos
Message 2 of 3
Thank you for reply.

Using a char array instead of VARIANT to read the group list, causes the program not to compile.

What am I doing wrong?
0 Kudos
Message 3 of 3