Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

using dynamically created CNiGraph objects

I am dynamically creating/allocating an array of CNiGraph objects since I do not know how many I will need at compile time. My project is a doc/view arch., SDI, in VC++ 6.0.

I declare a CNiGraph pointer in the view header, and in the view constructor I create the correct number of graphs like so:

pPlots = new CNiGraph[NumberOfPlotsNeeded];

and then I use the plots without problem.

The problem arises when I try to cleanup the memory I allocated for the plots ( using 'delete [] pPlots;' ).

This line creates a bad pointer error ('Expression: _CrtIsHeapValidPointer(pUserData)');

Could someone also direct me to some sample code using the CNiGraph control which has been dynamically created.


Thanks.
0 Kudos
Message 1 of 2
(2,941 Views)
Could you please post a small test project that isolates the problem?

In the meantime, here are a couple of articles that you might find useful:

Embedding a Dynamically Created Licensed Measurement Studio ActiveX Control in a Visual C++ Dialog W...
How Do I Create Controls Dynamically in Visual C++ When Using MFC without the Demo Mode Message Wind...

- Elton
0 Kudos
Message 2 of 2
(2,941 Views)