Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use CNiGraph in a thread function

I made a dialog-base MFC program in VC6.0. In the main dialog,I placed a CNiGraph control.
When the program begins, I created another thread,how can I use CNiGraph to plot in the created thread function?
Thank u!
0 Kudos
Message 1 of 3
(6,890 Views)
I have the same problem. When I try to access the Graph from the thread  program crashes. It found no solution on it. At the moment I store data and send a message to the dialog to update the graph. This is of course not a nice solution but it works.
0 Kudos
Message 2 of 3
(6,628 Views)

What you are trying to do should work as long as you are using the Measurement Studio C++ classes in MStudio version 6.0 or later.

What version of Measurement Studio are you using? Could you post a simple program that demonstrates the problem?

There is a fundamental limitation in Windows that prevents you from using a Window handle (HWND) in a different thread than the one that created it. However, the Measurement Studio C++ classes (e.g. CNiGraph) are designed to automatically handle accessing the underlying handle from multiple threads. This is done through standard COM marshaling mechanisms and was implemented in version 6.0 of Measurement Studio.

David Rohacek
National Instruments

0 Kudos
Message 3 of 3
(6,615 Views)