The problem is that you added the variable before the Measurement Studio Add/Remove Class Library wizard had a chance to put ,into the project file, the information that associates the Measurement Studio-provided classes with the ActiveX controls. To fix the problem: 1) remove from your project the files that the Add Variable Wizard generated (graph.h and graph.cpp in your case, cwgraph.h and cwgraph.cpp in the default case); 2) go to the header file of the dialog or view class to which you added the graph and remove the #include for the generated header file (graph.h in your case); and 3) change the data type of the member variable (m_graph in your case) to CNiGraph. Use the Measurement Studio-supplied data types instead of the automatically generated data types. These data types are documented in the Measurement Studio reference. See the Using the Measurement Studio Visual C++ User Interface Controls topic in the Measurement Studio help for more information.
A more detailed explanation of how the Add Variable Wizard works follows.
The process you went through causes Visual C++ to generate wrapper classes for the Measurement Studio ActiveX controls. Unfortunately, Visual C++ does not generate the wrappers properly, as explained in
this National Instruments Knowledge Base entry.
Measurement Studio includes a set of custom C++ classes that provide interfaces to the Measurement Studio ActiveX controls. The names of these classes begin with CNi. For example, the graph class is CNiGraph and the axis class is CNiAxis. Besides being complete, these classes offer a variety of benefits over the automatically generated wrappers. These benefits include function overloading, support for calling the control from any thread, and automatic data type translation from COM data types such as BSTR and SAFEARRAY to MFC data types and MFC-based Measurement Studio data types such as CString and CNiReal64Vector.
The Visual Studio Add Variable Wizard requires that information be added to the Visual C++ project file so that the wizard knows what C++ class to use in the member variable declaration for the ActiveX control. If the Add Variable Wizard does not find this information in the C++ project file, it generates the wrappers and puts the information into the project file.
The Measurement Studio Add/Remove Class Libraries Wizard and the Measurement Studio new project wizards also add this information to the project file when you add a Measurement Studio class library that includes classes that provide interfaces to ActiveX controls. The Measurement Studio wizards, however, associate the Measurement Studio classes with the ActiveX controls. When you subsequently use the Visual Studio Add Variable Wizard, it sees the information that the Measurement Studio wizard put in the project file and therefore uses the Measurement Studio class instead of trying to generate a class.