Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

integrating MS controls in existing VC++ VS2005 project

Hi,

I have an existing data acquistion program which was converted from VC++ 6.0 to VS2005 successfully and now I am trying to integrate Measurement Studio 8.1 ActiveX controls for VC++ into the project.

I installed Measurement Studio 8.1 this morning and started browsing the manual.  There is lots of discussion and step by step instructions on how to CREATE a NEW MS VS2005 project, but no information on how to integrate MS controls into an existing VS2005 project.

After the installation, I opened my project and dropped a CWGraph (which took me an hour to figure out was the same as a CNIGraph object?  that's another question), and then I chose Add Variable.. in the normal way for a control in VS2005.

The ClassWizard created an instance of the CCwgraph object and inserted the .h and .c files for that class.  Then when I tried to compile, the compiler had no access to the definitions (declarations?) of a number of the functions listed in the insterted class header file.  There is still a piece missing in the MS controls integration puzzle.

Are there no step by step instructions on how to integrate controls into an EXISTING VC++ VS2005 project?

And if not then how do I do this?  And why aren't my controls called "CNIGraph", etc.. what's with the CW business?

thanks in advance,

Ryan Taylor
Servo Design Engineer
Quantum Storage Devices
0 Kudos
Message 1 of 8
(6,561 Views)
Hey Ryan,
 
 
Let me know if that helps.
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 8
(6,539 Views)
This seemed like a simple enough explanation and I thought it would work, but I am getting an interesting symptom.

When I add a CWGraph Control to my existing project dialog and choose "Add Variable...", I get the variable type "CCwGraph1" (no other choice), and then the cwgraph.h header file will not compile

When I do exactly the same on a new test project, I get the variable type "NI::CNiGraph" (no other choice), and everything compiles just fine.

I'm sure I did everything that the article you sent to me instructed.

what's happening here?
0 Kudos
Message 3 of 8
(6,534 Views)
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 8
(6,523 Views)
from the article:

"To convert from the auto-generated MFC wrappers to the custom Measurement Studio wrappers, you need to delete any Visual C++ generated wrapper files from your Windows project folder that contain a prefix of cw. You also need to delete the member variables that were created for the controls. After this, you will need to use the Add/Remove Components Wizard to add the CNi classes to your project. Then, the next time you add a variable to the control, Visual C++ will pick the CNi classes instead of asking you to generate the wrappers."

Could you explain this step in more detail?  I have compared the components in my project vs. my test project and they are all the same components in each one.  Which components specifically need to be added in order to get my controls to come up with the CNi class (not the CCw class)?

thanks, ryan
0 Kudos
Message 5 of 8
(6,520 Views)
okay after trying this a few times, it did finally work.  Maybe I was doing something out of order before, I just don't know.

Anyway:

I am trying to do something very simple here.  I have data coming into a NI-DAQ card into my VC++ app (VS2005), and I just want to plot the data in real time as it comes in.  Here is basically what I am doing.  And then I get a run-time error at the ChartY call.  This is a simple enough thing to do I would think.  Is there a simple example on how to just constantly plot incoming data into a graph (like a scope)?


   
    double        plot_data[1000];
    double        xInc;

    xInc = 50e-6;


    for (i=0;i<(int)arraySize;i++)
        {
            plot_data[i] = ((double)copy[i])/65536.0;                                //copy[i] is the data coming in.
            m_graph1.ChartY(plot_data[i],xInc);
        }
0 Kudos
Message 6 of 8
(6,503 Views)

The examples for VC++ and DAQmx are all located in this folder: C:\Program Files\National Instruments\MeasurementStudioVS2005\VCNET\Examples\DAQmx

You should be able to grab and example that demonstrates this from that folder.  I don't know if you are doing analog or digital so I can't really point you to a specific example.

Hope that helps.  Let me know if you have more questions about the specifics.

Regards,

Message Edited by Sam R on 02-09-2007 10:07 AM

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 8
(6,496 Views)
the DAQmx stuff is already working some time back (digital data acquisition and saving to file etc..)

But the graphing examples here were helpful:

C:\Program Files\National Instruments\MeasurementStudioVS2005\VCNET\Examples\UI\Graph\Graph Example


The reason it wasn't working before was that I was trying to access the graph object using the PlotY command from a worker thread, not the UI thread which handles all the UI messages.  Because I was trying to access it from within the worker thread (the DAQ thread which is always running when data is streaming in), I had to use the SendMessage() command and create an external function to call the PlotY command, now it is working.


0 Kudos
Message 8 of 8
(6,487 Views)