Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CWPictureDisp is missing when inserting Measurement Studio button to my applicat

I use Measurement Studio Update for Visual C++.net.
When I insert a Measurement studio button to my application and then add a variable to this control, a class (which name is the ID of the control) is created. When compiling, the Component CWPictureDisp (used in this class) is not recognized by Visual.How can I do to add it or to solve this problem?
0 Kudos
Message 1 of 7
(4,473 Views)
This is a Microsoft known issue. When you drop an ActiveX control on an MFC form in the manner you describe, a wizard generates wrapper classes that allow you to communicate with the control. The known issue is that the MFC code generation for ActiveX controls is incomplete. It does not generate code for types referenced by the ActiveX control.

This, however, is not the approach you should take to use the Measurement Studio ActiveX controls in your C++ project. Instead, use the Measurement Studio Add/Remove Components Wizard to add the UI component to your project. Then, just drop the control on your form and add your variable. You will see that the data type of the variable is CNiButton. This is a custom C++ class, included with Measurement Studio, that a
llows you to communicate with the control. This wrapper is preferred over the auto-generated MFC wrapper for a variety of reasons. For example, the custom wrapper allows you to call the control from any thread, and the custom wrapper automatically translates from ActiveX data types to Measurement Studio native C++ data types such as CNiReal64Vector.

For more information, see the Measurement Studio Reference help file (Start>>Programs>>National Instruments>>Measurement Studio>>Help>>Measurement Studio Reference). Check out

Visual C++ Help>>Tutorials>>Getting Started>>Measurement Studio for Visual C++ .NET>>Adding and Removing Components from Measurement Studio for Visual C++ Projects

and

Visual C++ Help>>Tutorials>>Getting Started>>Measurement Studio for Visual C++ .NET>>Manually Adding Measurement Studio Components to Projects

The latter will help you if your project is in such a state that the Add/Remove Component Wizard does not work.

David Rohacek
National Instru
ments
Message 2 of 7
(4,473 Views)
Thank you David for your very fast answer. However, the process you advised me to follow (add/remove components wizard) is exactly what I did to introduce these components. After adding the components I can see the activeX controls appearing in the toolbox "measurement studio". I then dropped the components as you suggest it and add the member variable. The type proposed to create this variable is : Ccwboolean1 for a CWBOOLEAN button. (I can't see CNiButton).
I gave in my first question the case of CWPictureDisp but many other components are concerned (CWPointer, CWStatistic...).
I maybe did not well understood your answer but the links you proposed me to consult I already did as they say.
Concerning the manually adding it seems really complicated, I hope t
here is easier solution. Have you other advice to give me whith these further information?
Thank you...
0 Kudos
Message 3 of 7
(4,473 Views)
Do you see this problem with a completely new project?

If you already added a variable for your control and the type is the Ccw type, the VS.NET Add Variable wizard will continue to show the Ccw type (this is correct behavior). In this case, you need to delete the variable and re-add it after having run the Measurement Studio Add/Remove Components wizard.

If you have already done this, there are a couple of other things that could be going wrong here.

Open up your project .vcproj file in a text editor. At the bottom of the file you should see a section. If this section is empty or has references to type that start with CCW, we need to fill it in with the correct entries. Use the Measurement Studio Application wizard (File>>N
ew>>Project>>Measurement Studio Projects>>Visual C++ Projects>>MFC Application) to create a dummy solution (make sure UI is checked). Close the dummy solution and then open its .vcproj file in a text editor. Copy the contents of the dummy .vcproj file's section into your project's section. Reload your solution and things should work.

If it already looks like this, the most likely cause is that a fix that Measurement Studio installs was overwritten. Did you reinstall VS.NET after installing Measurement Studio? If so, try to uninstall and then reinstall Measurement Studio to fix the issue. If that doesn't work, please file a report at ni.com/support so we can get in touch with you to try to figure out exactly what went wrong.

Irrespective of all of this, you can always explicitly change the type of the variable in the CDialog-derived class declaration (after running the Add Variable wizard). Just find the member variable you declared and change its type to CNi
Button. This assumes that you are including the appropriate Measurement Studio header files.

If you can, please post back to let us know what worked.

David Rohacek
National Instruments
0 Kudos
Message 4 of 7
(4,473 Views)
Hello David,
Thank you again for your advises. Here are the news:
1) Ccw type is always displayed even when I delete the variable and re-add it after having run Add/Remove Components wizard. Even in new project, the Ccw type appears directly.

2) I opened .vcproj file, and compared it to a dummy project, and everything was OK in the Global section (with CNiButton, CNiGraph...)

3) I removed Measurement Studio and then reinstalled it. I opened a new project, add the components by the right way. Measurement studio classes well appeared in the class tab. But the problem was still there.

4)What I noticed that can give you interesting information: The Measurement Studio tab in the toolbox was empty. (Actually I now remember that I had a m
essage when first opening Visual.net after Measurement Studio re installation : it was something like : Toolbox cannot be removed). To fill it I have to go to Toolbox customization and to choose the activeX I want. In the list of available ActiveX I have : CWButton (which become CWBolean once inserted) control, CWknob, CWGraph, CWGraph3D, CWDataSocket, CWNumEdit, CWSlide. Are these ActiveX the ones I must used? Is there any other? Where can I find them? Do you think the problem can come from this?

5) By explicitly changing the type of the variable in the wizard, it is accepted and the wrapper class name appeared in gray (desactivated). The wrapper class Ccwtype is then not created and I can compile the project. This seems to be a solution to avoid the problem. I hope that I will not have further issues due to this manipulation when programming the control actions. But this is not the real solution to the problem...
0 Kudos
Message 5 of 7
(4,473 Views)
Alia,

It seems that you are still using the ActiveX wrapper classes created by MSVC. There shouldn't be any CCW type anywhere on your project when you use the Measurement Studio Add/Remove Wizard (see image attached). If you have Measurement Studio for VC++ installed, you should see the CW ActiveX controls on your toolbox. When adding these to your form you should have no CCW types anywhere. The variables should be of types as follows:
CNiGraph m_graph;
CNiNumEdit m_cursorX;

Since you are in VS .NET, you need to install Measurement Studio 6.0 for VC++ .NET. This is free for you since you already have Measurement Studio 6.0 for Visual Studio 6.0.
You can request the CD at the following link:
http://digital.ni.com
/express.nsf/bycode/ex35us?opendocument〈=&node=

Regards,
Azucena
NI
0 Kudos
Message 6 of 7
(4,473 Views)
Azucena,
Thank you for your answer but I think you did not really catch the problem: I am using Measurement Studio 6.0 for VC++.NET since I have Visual C++. NET. I already asked for this free CD.
When I install it my toolbox keep empty : no National Instrument ActiveX controls in it.
When I use Add/Remove wizard (I exactly have the same window as you), classes are well inserted but my toolbox is still empty.
I have to customize it by myself by adding component to my toolbox. There the only choice I have is to choose CW (it is maybe normal).
Once customized, when I inserted a control to my dialog box, and try to add a variable, the default type is a CCW and I can see the MSVC wrapper class Ccw appearing. I know tha
t it is not normal but I would like to know why... I can force the type to CNiGraph or CNiNumEdit or other but it should be automatic... In fact it seems that the problem comes more from add variable wizard. Please see the attached vue of my Visual C++. net window and "add variable" wizard with the default type and wrapper class.
Thank you for your support.
0 Kudos
Message 7 of 7
(4,473 Views)