Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Update NiGraph from thread

I am using MSVC++ 6.0 and am utilizing a homegrown timer to update my status on the screen. This timer utilized a worker thread and calls a HandleTimer method in my dialog class to update the status. I can update all my MSVC++ widgets okay but when I go to update the NiGraph m_Graph via a m_Graph.ChartXY(x,y) it blows up. I can make the same call, m_Graph.Chart(x,y), via a button call back and it works fine. Yes, the values are doubles and they are initialized okay. Has anybody else run into this issue?
jim
0 Kudos
Message 1 of 2
(3,088 Views)
This is probably happening because you haven't called CoInitialize in the worker thread. You can confirm this by catching the exception and displaying it via CException::ReportError. If this is the case, you can fix the issue by calling ::CoInitialize(NULL) at the beginning of the worker thread and calling ::CoUninitialize() before the thread exits.
0 Kudos
Message 2 of 2
(3,078 Views)