Compile Errors with Measurement Studio ActiveX Controls in Visual C++ Primary Software: Measurement Studio>>Visual C++ SupportPrimary Software Version: 8.0.1 Primary Software Fixed Version: 8.0.1 Secondary Software: Measurement Studio>>Visual Basic Support
Problem: I'm trying to use one of the Measurement Studio ActiveX User Interface controls in Microsoft Visual C++ (MFC). When attaching a member variable to the control, a wizard generates some wrapper code and then creates the member variable. However, when I attempt to compile, I receive the following errors: c:\CtrlDialog4\graph.h(748): error C2061: syntax error : identifier 'CWAnnotation'
What happened and how do I correct this? Solution: The problem is that the member variable was added before the Measurement Studio Add/Remove Class Library wizard had a chance to put the information that associates the Measurement Studio-provided classes with the ActiveX controls into the project file. To fix the problem:
Measurement Studio includes a set of custom Visual 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 Visual 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 then uses the Measurement Studio class instead of trying to generate a class. Related Links: KnowledgeBase 2IECTLXL: Why Are the Microsoft Visual C++ .NET-Generated Wrappers for Measurement Studio ActiveX Controls Incomplete? KnowledgeBase 2MQCJIMQ: Adding Measurement Studio Controls to an MFC Project in Microsoft Visual C++ KnowledgeBase 0QECHJ1J: Loading Measurement Studio ActiveX Controls into Visual C++ 6.0 Attachments:
Report Date: 08/02/2004 Last Updated: 11/30/2006 Document ID: 3C1FIB5B |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
