Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Generated wrapper classes - how do I avoid them?

This is a follow-up to my question on 2/26/2002 , "Wrapper classes generated by VC++"...

VC++ generates wrapper classes for my Meas Studio6 controls like CNiKnob. So I must use CWKnob (generated and not as useful). I know it shouldn't be generating these wrappers, but what settings decides "generate/don't generate"?

My project is a .exe with several .dlls. I use Meas Studio controls in one dll only. BTW, when I use the MS6 Add/Remove Wizard again, it doesn't seem to recognise that I already used it to insert several Meas Studio components.

Any ideas how to stop the wrapper classes being generated?
0 Kudos
Message 1 of 10
(5,202 Views)
This inforation is stored in the .dsp file. Specifically, if you open your .dsp file in a text editor and scroll to the bottom you should see a series of entries that look like the following (where FrequencyResponse is replaced with your project name).

# Section FrequencyResponse : {D940E4D3-6079-11CE-88CB-0020AF6845F6}
# 2:5:Class:CNiKnob
# 2:10:HeaderFile:NiKnob.h
# 2:8:ImplFile:NiAll.cpp
# End Section

It is possible that the Add/Remove wizard is unable to properly parse and understand your .dsp file. If you attach your .dsp file to a post we can take a look at it to see what might be wrong. Alternatively, you can manually add these items to your .dsp file. This process is outlined in the help file. Search for "manually adding" no quotes, title
s only and you should see the topic.

Another thing to think about is whether the .dsp file changes are getting persisted. Sometimes when using source control one might not check out project files and when synching back up will have these changes overwritten.

David Rohacek
National Instruments
Message 2 of 10
(5,194 Views)
I have those lines in my .dsp and I have checked against the help topic "Manually Adding..". I had used the Add/Remove Wizard to add the components, and the project files seem to match up with the info in the help topic.

The changes have persisted in my .dsw and .dsp.

I'm attaching my .dsw and my .dsp. You'll recognise the Meas Studio parts.

Billy.
Download All
0 Kudos
Message 3 of 10
(5,194 Views)
Looking through the .dsp file I see that it does not contain any .rc files. There is another project that it depends on called XXXXX_Res. It looks like you are using an atypical (do not interpret this as "bad") idiom to manage your resources.

One suggestion that I have is for you to not use the Class Wizard to add member variables to control the Measurement Studio controls. Instead, you would add the member variable declarations to your header files directly. You would add the appropriate DDX_Control calls to your dialog box class's DoDataExchange function.

Then, to handle events, you would add the appropriate items to the message map. At this point, with everything set up manually, Class Wizard might be able to handle adding the event me
ssage maps and functions for you.

Although this might sound challenging, you can use a test project to see exactly what you should be adding to make things work.

If you really want to get this to work with Class Wizard, the first thing I would try would be to add Measurement Studio support to the project that contains the resources.

I'm interested in this problem but can't really get further without more information about how this application is put together. If the above two suggestions don't work for you, we'll either need you to create a simple test application that demonstrates the problem or we'll need for you to explain how the project is put together so that we can try to reproduce the problem here. If you want to go this route go to ni.com/ask to get to email support.

David Rohacek
National Instruments
0 Kudos
Message 4 of 10
(5,194 Views)
Excellent, finally cracked this by following a similar line to your description above...

I work as usual, insert control into dialog and wrapper classes are generated. Use ClassWizard to add member variable e.g. CCWKnob m_cwknob1.

Now, in the dialog's .h file change the CCWKnob to CNiKnob. Delete the wrapper class files from the project. Now I have a nice CNi object instead of a CCW object. I can use the proper CNi classes and their functions as they are described in the Reference Manual.

BTW: my .rc is kept in its own resource dll. This has no functionality. The idea is that the localisation process is much simpler.

Thanks David !!!!
Billy H.
0 Kudos
Message 5 of 10
(5,194 Views)
I had a similar problem using Visual Studio .NET and Measurement Studio 7.1 in that wrapper classes were being automatically generated by VS .NET when I added a class variable to my FormView.
Using your solution of simply changing the class to what it should have been in the first place and deleting the wrapper classes from the Solution worked fine for this problem as well.

Thanks very much.
0 Kudos
Message 6 of 10
(5,141 Views)
hi, I tried it in my VC++ program, but failed,it not like what you said. My program is bulit just in pure MFC(exe), and I add the knob control component to the project, and just did as you said, but failed, it showed CNiKnob can't define the m_knob. I dont know what's wrong with my program?? help
0 Kudos
Message 7 of 10
(4,987 Views)
hi, billy, i attached my program, and you can have a look, i tried simple example like yours. What's the problem ?? hope you can handle it!!! thanks alot
0 Kudos
Message 8 of 10
(4,982 Views)
sorry, that format is wrong, this is the right one! thanks!!!
0 Kudos
Message 9 of 10
(4,980 Views)
Hi,

I wasn't able to open your code for some reason. My advice to you regarding this issue is to take a look at the shipping example using a Measurement Studio Knob. Have a look at the composition of the project. Again, I suggest that when you start a new project that you start with a Measurement Studio project. This automatically handles some of the overheads which you would have to do manually if you started with a non-measurement studio project.

Make sure that if you are adding Measurement Studio controls that the User Interface class libraries are included. From the menu select , , in the dialog box select User Interface.
0 Kudos
Message 10 of 10
(4,963 Views)