Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio 6 Exception (VC6)

My application threw an exception via AfxThrowOleDispatchException()
The exception text was 'Can't plot/chart data, out of memory'

Is this due to a limit in the CNiGraph (can I just stop plotting data on the
graph) or is it more serious (do I have to stop my application because
system memory is too low for anything to be reliable).

Also, is there a way to stop the graph from making a local copy of the data
to be plotted. This way I could manage the memory requirements without
having to worry about the exception.

Are there examples of how to trap these exceptions?
0 Kudos
Message 1 of 7
(3,851 Views)
I'm guessing that it's because system memory is low. There's not a way to stop the graph from making a local copy of the data, but you can control how much data the graph stores - check out the CNiGraph::ChartLength property.

A few of the Measurement Studio for VC++ examples demonstrate how to catch MFC exceptions. You can find them by searching the Examples folder for "CException." In short, it would look like this:

try
{
// Execute code ...
}
catch (COleDispatchException* e)
{
// Handle exception ...

e->Delete();
}

- Elton
0 Kudos
Message 2 of 7
(3,850 Views)
Thanks for the quick reply.

Limiting the chart length doesn't help us. We need to monitor days, weeks,
even months of data and we don't want to set an arbitrary limit especially
if the user has lots of memory.

Your code fragment shows COleDispatchException. What is CNiException used
for? Why would I use it? Why wouldn't it be used here?

Thanks again


"Elton Wells" wrote in message
news:506500000005000000AA810000-1023576873000@exchange.ni.com...
> I'm guessing that it's because system memory is low. There's not a
> way to stop the graph from making a local copy of the data, but you
> can control how much data the graph stores - check out the
> CNiGraph::ChartLength property.
>
> A few of the Measurement Studio for VC++ example
s demonstrate how to
> catch MFC exceptions. You can find them by searching the Examples
> folder for "CException." In short, it would look like this:
>
> try
> {
> // Execute code ...
> }
> catch (COleDispatchException* e)
> {
> // Handle exception ...
>
> e->Delete();
> }
>
> - Elton
0 Kudos
Message 3 of 7
(3,850 Views)
CNiException is a CException-derived class that's used as a base class for Measurement Studio for VC++ specific exceptions, such as CNi4882Exception, CNiSystemException, etc. You could catch CNiException to catch CNiException or any of its derived classes, but it wouldn't let you catch COleDispatchException since it's derived from CException, not CNiException.

- Elton
0 Kudos
Message 4 of 7
(3,850 Views)
Thanks again.

How can I know if the exception is a memory error and not something else?
I would like to change the chart length if I get the memory error so that
old data will go away in place of new data, but I don't want to do that for
any error I may get.



"Elton Wells" wrote in message
news:506500000005000000C4810000-1023576873000@exchange.ni.com...
> CNiException is a CException-derived class that's used as a base class
> for Measurement Studio for VC++ specific exceptions, such as
> CNi4882Exception, CNiSystemException, etc. You could catch
> CNiException to catch CNiException or any of its derived classes, but
> it wouldn't let you catch COleDispatchException since it's derived
> from CException, not CNiException
.
>
> - Elton
0 Kudos
Message 5 of 7
(3,850 Views)
If a memory error is thrown from MFC, the exception could be CMemoryException or it could be COleException and the m_sc member could be set to E_OUTOFMEMORY.

If the exception is an MFC exception, you could run the following test to find out what the type of the exception is:

try
{
// Execute code that causes exception to be thrown
}
catch (CException* e)
{
MessageBox(e->GetRuntimeClass()->m_lpszClassName);
e->Delete();
}
catch (...)
{
MessageBox(_T("Not an MFC exception"));
}

- Elton
0 Kudos
Message 7 of 7
(3,850 Views)
Is there a function call or a variable that can be set which will cause the
graph to release the memory it took to cache the data points?



"Elton Wells" wrote in message
news:506500000005000000C4810000-1023576873000@exchange.ni.com...
> CNiException is a CException-derived class that's used as a base class
> for Measurement Studio for VC++ specific exceptions, such as
> CNi4882Exception, CNiSystemException, etc. You could catch
> CNiException to catch CNiException or any of its derived classes, but
> it wouldn't let you catch COleDispatchException since it's derived
> from CException, not CNiException.
>
> - Elton
0 Kudos
Message 6 of 7
(3,851 Views)