Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating CniNumEdit from another thread

I get the following Exception,
First-chance exception in pmdcsimulator.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
My call Stack looks as below,
KERNEL32! 77f1d479()
MSVCRTD! _CxxThrowException@8 + 57 bytes
AfxThrowOleDispatchException(unsigned short 0, const char * 0x00433e1c, unsigned int 0) line 1574
PMDCSIMULATOR! NI::CNiControl::CheckThreadId(void) + 91 bytes
PMDCSIMULATOR! NI::CNiControl::ValidateControl(void) + 22 bytes
PMDCSIMULATOR! NI::CNiNumEdit::SetValue(double) + 62 bytes
CPmdcsimulatorDlg::AcquisitionWorkFunction() line 1147
CPmdcsimulatorDlg::AcqProcessThreadFunction(void * 0x0012f2dc) line 1159
_AfxThreadEntry(void * 0x0012ec58) line 112 + 13 bytes
_threadstartex(void * 0x010
96f80) line 212 + 13 bytes
KERNEL32! 77f04ede()
How do I update the control..?
0 Kudos
Message 1 of 6
(4,233 Views)
The UI control classes in Measurement Studio 1.0.1 do not support access from other threads. The next release of Measruement Studio will remedy this problem. Until then, there is an example program that shows how you can use a user message to work around this here: http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&24C350515009D6A1862569AC0073ACC6&cat=61B119A9F74ADC07862568C50070CE22

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 6
(4,233 Views)
I cannot update a double associated with CNiNumEdit as PostMessage(WPARAM, LPARAM)
and LPARAM is LONG only.
I did not find any sample using DataSocket..
0 Kudos
Message 3 of 6
(4,233 Views)
You can pass a pointer to any object in the LPARAM. Then cast it back to the right data type in the event handler. Or you can make your data a global variable or member variable of the class.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 4 of 6
(4,233 Views)
Thanks, I did that, updating a class member and then doing a post message.
0 Kudos
Message 5 of 6
(4,233 Views)
Thanks, I did that, updating a class member and then doing a post message. the class variable updates CNiNumEdit using this variable in when that userdefined message handler is called.
0 Kudos
Message 6 of 6
(4,233 Views)